Re: Gtk::Widget::on_hide



No crash when I run it on Linux (Ubuntu 13.10). When on_hide() is called, gobject_ is not 0. I used gtkmm 2.24.4 instead of 2.24.2. I would be surprised if that matters.

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 ?

Kjell

2013-11-18 18:23, John Emmas skrev:
On 18/11/2013 14:59, Alan Mazer wrote:
The G_OBJECT_GET_CLASS macro is probably dereferencing gobject_, e.g., replacing it with gobject_->class or some such...


Perhaps so. That would certainly explain the crash if 'gobject_' was NULL - but as I try to debug this issue things become even more confusing. Consider this sample program:-

        #include <gtkmm/main.h>
        #include <gtkmm/dialog.h>

        int main (int argc, char *argv[])
        {
            Gtk::Main    app (&argc, &argv);
Gtk::Dialog* mainWnd = new Gtk::Dialog ("Hello World", true, true);

            app.run( *mainWnd );

            delete mainWnd;
            return 0;
        }

The above example runs exactly as expected displaying a small, empty dialog window entitled "Hello World". Now consider this extended example which uses a class derived from Gtk::Dialog:-

        #include <gtkmm/main.h>
        #include <gtkmm/dialog.h>

        class MyDialog : public Gtk::Dialog {
        public:
MyDialog (const Glib::ustring& title, bool modal, bool use_separator);
        };

MyDialog::MyDialog (const Glib::ustring& title, bool modal, bool use_separator)
            : Gtk::Dialog (title, modal, use_separator)
        {
        }


        int main (int argc, char *argv[])
        {
            Gtk::Main    app (&argc, &argv);
            MyDialog* mainWnd = new MyDialog ("Hello World", true, true);
            app.run( *mainWnd );

            delete mainWnd;  // <--- crashes here !!
            return 0;
        }

When built using MSVC and gtkmm v2.24.2, the extended example consistently crashes at the line "delete mainWnd;". It either crashes in Gtk::Widget::on_hide() or slightly later, in Gtk::Widget::on_unrealize(). It's almost as if the C++ window object is going out of scope before gtkmm has finished its cleanup. Could this be a threading issue? I haven't created any threads (as you can see) so unless gtkmm or gtk+ created some I don't see how threading could be the problem. Or is there something obviously wrong which I'm failing to see??

John
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




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