Re: Gtk::Widget::on_hide



Yes, G_OBJECT_GET_CLASS(gobject_) dereferences gobject_.
on_hide() should not be called when gobject_ is 0. Two possible reasons it is called:

1. There is a bug in gtkmm 3.7.12 and 3.8.0 that can make such a call happen.
See https://bugzilla.gnome.org/show_bug.cgi?id=605728#c5
That bug was fixed in 3.8.1.

2. Your program calls Gtk::Widget::on_hide(). You should not do that unless you really know what you're doing. on_hide() is the default signal handler of the hide signal. If you want to, you can override it in a derived class, and wait for it to be called when the hide signal is emitted, but don't call it yourself.

Kjell

2013-11-18 15:59, Alan Mazer skrev:
The G_OBJECT_GET_CLASS macro is probably dereferencing gobject_, e.g., replacing it with gobject_->class or some such...

-- Alan


On 11/18/2013 6:53 AM, John Emmas wrote:
I'm trying to debug a program which keeps crashing in 'Gtk::Widget::on_hide()'. Here's what that function looks like:-

    void Gtk::Widget::on_hide()
    {
      BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
      );

      if(base && base->hide)
        (*base->hide)(gobj());
    }

Every time the crash occurs, variable 'gobject_' is always NULL. Although I'm currently trying to figure out why, the above code looks (to my untrained eye) as though it should be reasonably well behaved with a NULL gobject_. It looks as if that function should be safe, even when gobject_ is NULL. Is that a reasonable assessment or just wishful thinking on my part?

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

_______________________________________________
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]