> What reason to call delete explicitly?
> As I understand, you works with pointers to WWidget. So, you should use
> removeWidget(..) to let Wt remove widget from the widget tree instead
> of explicitly delete them "manually".

Are you saying explicit deletion doesn't cleanup connections properly?
Using delete also calls the destructors of the widget's base class and
removes itself from the parent just like removeWidget() along with
removing itself signal/slot system before the widget is deleted.

Using removeWidget() will work but managing widgets with no parents
and knowing the right time to delete them is going to be awkward (I
don't know if there will be another signal triggering it's deletion
again).

Let me explain my tricky situation:

In the destination widget's dropEvent(), the source widget doesn't get
directly deleted. Instead the destination widget uses the source
widget's database record key for a server push. This push signals all
listening sessions to delete the widget that has that key. This is an
effort to keep all renderings of the source widget sync'd across all
sessions.(I'm making an interactive map of a building and people
should see each other's influences on objects in the map in
real-time.)

The problem is that the widget doesn't disappear instantly enough from
the screen while during the deletion process and its possible during
the tiny time frame to drag and drop a widget more than once and cause
a crash.

WApplication::encodedObjects_, which is a std::map, helps in
identifying c++ objects in the javascript that deals with dragging and
dropping. Objects set as draggable have an entry created in
encodedObjects_ . But once those widgets are deleted, their entries
still remain. This is an issue because their entries resolve from
unique id strings to invalid source widget pointers that are emitted
by WDropEvents.

There are work-arounds for my problem but it would be neat if a
removeEncodedObject() method existed.

Regards,
David

------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to