Destroy widgets nad callback

Hello,

I have big problem with destroy widgets functions.
I don’t known how resolve it.


I create widget “NAME A” which call callback function.

If I want to destroy widget “NAME A” in this callback function
then Photon destroy my program and I see SIGSEGV addresses. :slight_smile:

What’s happen?

What is way to resolve this problem?

Best Regards
Gerard Jarecki

“Gerard Jarecki” <gjarecki@mikrobsa.com.pl> wrote in message
news:3AC32189.B8FD3F1D@mikrobsa.com.pl

Hello,

I have big problem with destroy widgets functions.
I don’t known how resolve it.

I create widget “NAME A” which call callback function.

If I want to destroy widget “NAME A” in this callback function
then Photon destroy my program and I see SIGSEGV addresses. > :slight_smile:

What’s happen?

probably this is not so good idea to destroy widget from its callback.

What is way to resolve this problem?

to do it more safety way destroy it in somewhere another place, for
example in your main deinitialization code.

Best Regards
Gerard Jarecki

I create widget “NAME A” which call callback function.

If I want to destroy widget “NAME A” in this callback function
then Photon destroy my program and I see SIGSEGV addresses. > :slight_smile:

Usally, it is no problem to destroy a Widget inside the callback function.
The widget is in this time only marked as destroy. When you
comeback in the Photon Mainloop the widget will be really destroyed.
You can call PtSyncPhoton(), if need the destroying at this point.
After the call all Pt_CB_DESTROYED callbacks will be called.

You run in an another problem. If the widget created inside
PhAB, you should normally do not delete it. The phab library
think that this still exist, but it does not at this point.
Try to use PtUnrealizeWidget and PtRealizeWidget or
you can set a flag that the widget will not be realized at normal
point, when it’s parent realized.

PtArg_t arg;

PtSetArg( &arg, Pt_ARG_FLAGS, Pt_TRUE, Pt_DELAY_REALIZE );
PtSetResources( widget, 1, &arg );

\

Bye Sascha( sascha@bitctrl.de )

Sascha Morgenstern
BitCtrl Systems GmbH
Weißenfelser Straße 67
Germany - 04229 Leipzig
Phon. +49 341 490 670
FAX. +49 341 490 67 15
eMail: sascha@bitctrl.de
WWW: http://www.bitctrl.de