PhAB bug?

hello,

it seems to me as if PhAB has a bug with custom-widget-handling:

when you close a project made out of custom-widget(s), then PhAB destroys
the custom-widget(s) in it - but when you reopen the same project then
PhAB skips the widget-creation call, so PhAB works with some unallocated
pointer for that custom-widget - this results in a PhAB-crash at the
latest when PhAB tries to close the project

the same scenario occurs when you drag a custom widget from the
templates-pane on the right into the form - PhAB calls only once the
widget-creation function but destroys it everytime it is removed from the
form

is it a bug or how can a widget-programmer avoid the crashes?

thanks!

Hi…
When a project is opened, phab will build all the widgets that are in
the currently displayed links ( the links are either iconified or
displayed ).
If you specify a dll that contains the widget codefor creating the
widget class,
then phab will use that code and will create the “real” widget for you(
use palette.def to specify your dll )
If you don’t provide a dll with your widget code, then phab will emulate
the widget for you using a PtBasic or a PtContainer, depending on the
line b=Container or b=Basic (the default is b=Basic if the line b= is
missing ).
So either way, you should see either the “real” widget or an emulate
widget(PtBasic or PtContainer).
All this is described in
/usr/help/product/photon_2.0_en/wid_build/bind.html in our docs.

When a custom widget is created( dragged from the palette of widgets
into the canvas ), the same thing happens, you get a valid widget,
emulated or not.

Adrian

mirtch wrote:

hello,

it seems to me as if PhAB has a bug with custom-widget-handling:

when you close a project made out of custom-widget(s), then PhAB destroys
the custom-widget(s) in it - but when you reopen the same project then
PhAB skips the widget-creation call, so PhAB works with some unallocated
pointer for that custom-widget - this results in a PhAB-crash at the
latest when PhAB tries to close the project

the same scenario occurs when you drag a custom widget from the
templates-pane on the right into the form - PhAB calls only once the
widget-creation function but destroys it everytime it is removed from the
form

is it a bug or how can a widget-programmer avoid the crashes?

thanks!

Adrian Mardare wrote:


Hi…
When a project is opened, phab will build all the widgets that are in
the currently displayed links ( the links are either iconified or
displayed ).
If you specify a dll that contains the widget codefor creating the
widget class,
then phab will use that code and will create the “real” widget for you(
use palette.def to specify your dll )
If you don’t provide a dll with your widget code, then phab will emulate
the widget for you using a PtBasic or a PtContainer, depending on the
line b=Container or b=Basic (the default is b=Basic if the line b= is
missing ).
So either way, you should see either the “real” widget or an emulate
widget(PtBasic or PtContainer).
All this is described in
/usr/help/product/photon_2.0_en/wid_build/bind.html in our docs.

When a custom widget is created( dragged from the palette of widgets
into the canvas ), the same thing happens, you get a valid widget,
emulated or not.

Adrian

mirtch wrote:
hello,

it seems to me as if PhAB has a bug with custom-widget-handling:

when you close a project made out of custom-widget(s), then PhAB destroys
the custom-widget(s) in it - but when you reopen the same project then
PhAB skips the widget-creation call, so PhAB works with some unallocated
pointer for that custom-widget - this results in a PhAB-crash at the
latest when PhAB tries to close the project

the same scenario occurs when you drag a custom widget from the
templates-pane on the right into the form - PhAB calls only once the
widget-creation function but destroys it everytime it is removed from the
form

is it a bug or how can a widget-programmer avoid the crashes?

thanks!
\

maybe you didn’t understand my problem: I see my widget after loading or
dragging and I also provided a dll for PhAB to execute - but the problem
is: the widget creation function is only called once, that means if you
close your project or remove the widget from the canvas it will be
destroyed (via destroy function specified in my dll) but after reloading
or re-dragging the creation function is skipped :frowning: so the following close
or remove definitly leads to a PhAB-crash wherever you use dynamically
allocated memory in your widget

Eremia A wrote:


“mirtch” <> mirtch@gmx.net> > wrote in message
news:b9rfph$f0s$> 1@tiger.openqnx.com> …

maybe you didn’t understand my problem: I see my widget after loading or
dragging and I also provided a dll for PhAB to execute - but the problem
is: the widget creation function is only called once, that means if you
close your project or remove the widget from the canvas it will be
destroyed (via destroy function specified in my dll) but after reloading
or re-dragging the creation function is skipped > :frowning: > so the following close

After reloading or re-dragging, an instance of the widget is created by
invoking PtCreateWidget( class, … ). Phab gets an instance of your widget
( a PtWidget_t*). Is your “default” function ( the one that sets the default
values in your widget instance ) called? It should be. The same applies for

my default function is called

the other functions involved in setting up the instance ( init, connect
etc ). They are called.
What do you mean by “widget creation function” ? If you mean the function
that instantiate the class widget record, then that function I think it’s
supposed to be called only once.

yes I mean it - so I have to allocate my memory in default-function and
realease it as usual when destroy is called…ok, now I see my mistake - I
just thought the creation function belongs to the class methods of a widget

or remove definitly leads to a PhAB-crash wherever you use dynamically
allocated memory in your widget

thanks!

“mirtch” <mirtch@gmx.net> wrote in message
news:b9rfph$f0s$1@tiger.openqnx.com

maybe you didn’t understand my problem: I see my widget after loading or
dragging and I also provided a dll for PhAB to execute - but the problem
is: the widget creation function is only called once, that means if you
close your project or remove the widget from the canvas it will be
destroyed (via destroy function specified in my dll) but after reloading
or re-dragging the creation function is skipped > :frowning: > so the following close

After reloading or re-dragging, an instance of the widget is created by
invoking PtCreateWidget( class, … ). Phab gets an instance of your widget
( a PtWidget_t*). Is your “default” function ( the one that sets the default
values in your widget instance ) called? It should be. The same applies for
the other functions involved in setting up the instance ( init, connect
etc ). They are called.
What do you mean by “widget creation function” ? If you mean the function
that instantiate the class widget record, then that function I think it’s
supposed to be called only once.

or remove definitly leads to a PhAB-crash wherever you use dynamically
allocated memory in your widget