Hi,
Thanks for digging this!
Best,
Scuri
2017-10-17 10:16 GMT-02:00 Jiří Klimeš <[email protected]>:
> On Wed, 11 Oct 2017 18:42:26 -0300
> Antonio Scuri <[email protected]> wrote:
>
> > Actually I take back what I said, we can use your fix:
> >
> > + g_signal_handlers_disconnect_by_data(G_OBJECT(ih->handle), ih);
> > + parent = iupDialogGetNativeParent(ih);
> > + if (parent)
> > + g_signal_handlers_disconnect_by_func(G_OBJECT(parent),
> > gtkDialogChildDestroyEvent, ih);
> >
> >
> > But I think there is another serious problem in what we are doing.
> > Suppose we have several dialogs that set their parentdialog to the
> > same main dialog. Those "child" dialogs will all call:
> >
> > g_signal_connect(G_OBJECT(parent), "destroy",
> > G_CALLBACK(gtkDialogChildDestroyEvent), ih);
> >
> > So for the same parent, they will al set destroy, but each time one
> > will replace another and only the last one set will actually be
> > called. Am I right? Or I misunderstood g_signal_connect? Does every
> > call to g_signal_connect with a different data will ensure a
> > different callback association? I can't remember and I couldn't find
> > this info explicit in GLIB docs.
> >
> > Thanks,
> > Scuri
> >
> > PS: already committed your contribution.
> >
>
> Thanks for committing the fix.
>
> As for the GLib signals handlers, I think you are safe and no problems
> should occur in that regard.
> Each call of g_signal_connect() creates a unique signal handler that is
> identified by an ID (returned by g_signal_connect()).
> Even if the GLib docs may not be explicit, the behaviour can be
> inferred from various description in Glib docs.
> This sentence from
> https://developer.gnome.org/gobject/stable/signal.html
> "When a signal is emitted on a given type instance, all the closures
> connected to this signal on this type instance will be invoked. All the
> closures connected to such a signal represent callbacks whose signature
> looks like..."
> seems to support that best.
> The signal handlers are also called in a deterministic way.
> https://developer.gnome.org/gobject/stable/gobject-Signals.html says:
> "The user-provided signal handlers are called in the order they were
> connected in."
> And if you look at the source code, you would find that the handlers
> are all stored in a hash table and don't replace itself.
>
> I've written a quick test confirming that all signal handlers are
> called (even if the g_signal_connect() is completely the same,
> including the data parameter). Find the code in the attachment.
>
> Best regards,
> blueowl
>
> PS: GLib documentation is traditionally cumbersome. Not only in regards
> to signals. But the very basic concept of GObject creation is very hard
> to understand from the official documentation [1]. It is described much
> much better here [2].
>
> [1] https://developer.gnome.org/gobject/stable/chapter-gobject.html
> [2] https://blogs.gnome.org/desrt/2012/02/26/a-gentle-
> introduction-to-gobject-construction/
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users