Re: Gtk::SpinButton crash




2013-11-22 14:57, John Emmas skrev:
        Gtk::SpinButton some_spin_button;
        Gtk::Adjustment some_adjuster (2, 0, 100, 1, 10, 0);
        some_spin_button.set_adjustment (some_adjuster);

If I include the above lines in any gtkmm app (and build with MSVC) the app eventually crashes at the stage where 'some_spin_button' is getting destroyed (this is with gtkmm 2.24.4).  If the app is run from a command line, Windows outputs a message saying "pure virtual function call" and then terminates it.  A couple of things might be significant:-

       1)  If I comment out the 3rd line the crash doesn't happen.
       2)  The crash has a very similar feel to the problem I reported very recently with derived windows and dialogs (i.e. the signs are very much like a C++ wrapper got disconnected from its C object too early).
       3)  The crash happens in 'gtk_spin_button_finalize()' while executing this line:-

               gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (object), NULL);

I could provide a more comprehensive example if needed but I thought I'd check first in case this is already a known issue.  AFAICT just adding those three lines to any gtkmm app is enough to trigger the problem.

John
I copied your MyDialog example, and added the above three lines to MyDialog's constructor. When I ran it with gtkmm 2.24.4 (no patches added) it does not crash. Valgrind does not report any accesses to freed memory, but that's perhaps not very informative in this case. I don't think valgrind checks accesses to memory on the stack.

Did you test with or without the patches from bug 605728? Does the order of definition of some_spin_button and some_adjuster matter? When some_spin_button is defined before some_adjuster, some_adjuster will be deleted before some_spin_button (at least the C++ part of it, probably not the underlying GtkAdjustment).

What's going on in your system? I get a feeling that the patches you've applied to your copy of gtkmm 2.24.4 only hide the symptoms of a different bug than the one those patches fixed in gtkmm 3.

Kjell



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