Re: Gtk::Widget::on_hide




2013-11-19 10:40, John Emmas skrev:
On 18/11/2013 19:16, John Emmas wrote:

On 18/11/2013 18:32, Kjell Ahlstedt wrote:

Seems quite similar to the problem you described in
https://mail.gnome.org/archives/gtkmm-list/2013-November/msg00000.html
Have you got any further with the trouble-shooting after
https://mail.gnome.org/archives/gtkmm-list/2013-November/msg00024.html ?

 You're right, it's exactly the same issue.  [...]  I'll resume my trouble-shooting on that previous issue and report back what I find.


Okay, it only took a few minutes to resume my trouble-shooting so I've just added an update about what I found.

Getting back to the "MyDialog" example I supplied yesterday, this is the sequence of function calls when closing MyDialog on my system:-

1)  Gtk::Widget::on_hide() // occurs on window closure (BEFORE the call to delete).  Therefore 'gobject_' is still valid
2)  Window::_destroy_c_instance()  // occurs during the call to 'delete' and subsequently calls....
3)  Object::disconnect_cpp_wrapper()  // invalidates 'gobject_' (sets it to NULL)
4)  Gtk::Widget::on_unrealize() // crashes because gobject_ == NULL

Kjell, if you can find some time today could you try building MyDialog and verify if you see the same sequence?  If you do, we'll need to figure out why your gcc build is tolerant of gobject_ being NULL whereas my MSVC build isn't.  I feel as if we're getting quite close to a solution though.  Many thanks.

John
I have run your MyDialog program with gtkmm 2.24.4 on Linux. I can verify that I do not see the same sequence.
Steps 1, 2, and 3 are the same, but Gtk::Widget::on_unrealize() is not called. Widget_Class::unrealize_callback() is called, but on_unrealize() is not called from there, because Glib::ObjectBase::_get_current_wrapper((GObject*)self) returns 0, and obj_base is 0.
_get_current_wrapper() returns 0, because Gtk::Object::disconnect_cpp_wrapper() removed Glib::quark_.

You mentioned in https://mail.gnome.org/archives/gtkmm-list/2013-November/msg00022.html that you have "glibmm_Glib::quark_" in the list of GQuarks, when I have "glibmm_Glib::quark_cpp_wrapper_deleted_". It's as if

    g_object_steal_qdata((GObject*)gobj(), Glib::quark_);
    g_object_set_qdata((GObject*)gobj(), Glib::quark_cpp_wrapper_deleted_, (gpointer)true);

in Gtk::Object::disconnect_cpp_wrapper() don't do what they should. Confusing!

In your example with Gtk::Dialog instead of MyDialog, the crash is avoided because in Widget_Class::unrealize_callback() obj_base->is_derived_() is false, and on_unrealize() is not called even if obj_base != 0.

Kjell



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]