Destroying a custom widget

I’ve derived a CustomWidget from PtContainer. It has several child widgets - including other CustomWidgets.
When I try to destroy a CustomWidget with PtDestroyWidget(), i get a SIGSEGV error.
The only information I have is the contents of the debugger when the error occurs:

0 _list_release ()
1 free()
2 PtRemoveWidgetInstance()
3 PtRemoveWidget()
4 PtSyncPhoton()
5 PtAppProcessEvent ()
6 PtAppMainLoop ()
7 PtMainLoop ()
8 main() at /home…/abmain.c

The widget instance structure:

typedef struct element_widget{
PtContainerWidget_t container;
PtLabelWidget_t *box;
short orientation;
short inputnumber;
short outputnumber;
short status;
ConnectorWidget *input[ MAXCONNECTOR ];
ConnectorWidget *output[ MAXCONNECTOR ];
PtWidget_t *selectionmarker[8];
} CustomWidget;

The pointers point to the children of the CustomWidget.
Can anyone help me?
Thanks in advance