Re: Gtk::Widget::on_hide




Okay... I just finished applying the patches. I've by no means carried out any exhaustive testing but initial signs are that it's fixed the crashing issue. I'll do some more comprehensive testing tomorrow but my first impression is that this stuff is still some way from working elegantly. For example, Gtk::Widget::on_unrealize() is a virtual function. However, if I override it in my derived class (MyDialog, which is derived from Gtk::Dialog), Gtk::Widget::on_unrealize() continues to get called, instead of MyDialog::on_unrealize(). Unfortunately, I can't tell whether that problem already existed or whether the patches are somehow responsible. To be fair though, that's the only issue I've noticed so I think we can definitely regard this as progress!

A backtrace from gdb when unrealize_callback() is called, looks like so:

#0  Gtk::Widget_Class::unrealize_callback (self=0x6c60d0) at widget.cc:4038
#1 0x00007ffff5291007 in _g_closure_invoke_va (closure=0x6af8f0, return_value=0x0, instance=0x6c60d0, args=0x7fffffffd728, n_params=0, param_types=0x0) at gclosure.c:840 #2 0x00007ffff52aae5c in g_signal_emit_valist (instance=0x6c60d0, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args entry=0x7fffffffd728) at gsignal.c:3238
#3  0x00007ffff52ab732 in g_signal_emit (instance=instance entry=0x6c60d0,
    signal_id=<optimized out>, detail=detail entry=0) at gsignal.c:3386
#4 0x00007ffff59c3592 in IA__gtk_widget_unrealize (widget=0x6c60d0) at gtkwidget.c:3605 #5 0x00007ffff59c4a20 in gtk_widget_dispose (object=0x6c60d0) at gtkwidget.c:8791 #6 0x00007ffff5297730 in g_object_run_dispose (object=0x6c60d0) at gobject.c:1077
#7  0x00007ffff7a1817f in Gtk::Dialog::~Dialog (this=0x6ac020,
__vtt_parm=0x405688 <VTT for MyDialog+8>, __in_chrg=<optimized out>) at dialog.cc:226 #8 0x000000000040509a in MyDialog::~MyDialog (this=0x6ac020, __in_chrg=<optimized out>,
    __vtt_parm=<optimized out>) at main2.cc:9
#9 0x0000000000405188 in MyDialog::~MyDialog (this=0x6ac020, __in_chrg=<optimized out>,
    __vtt_parm=<optimized out>) at main2.cc:11
#10 0x0000000000404f82 in main (argc=1, argv=0x7fffffffd9c8) at main2.cc:34

It's called (indirectly) from Gtk::Dialog::~Dialog(). At that time the object is not a MyDialog any more. Calling virtual functions from constructors and destructors is best avoided. It's not always easy to guess which override will be called.

Kjell



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