[gtkmm] Method Gtk::Object::destroy_notify_() (in File gtk/gtkmm/object.c c) contains a "delete this"



Hi!

I still looking for the cause of bug
http://bugzilla.gnome.org/show_bug.cgi?id=78578
and I found the "delete this" statement in gtk/gtkmm/object.cc

I hope the author of the "delete this" considered the following:

Your program will crash (or behave strangely) if the object
- was not created with 'new'; (might _NOT_ be allocated on the heap, but on
the stack ... which could cause a disaster)
- is a member of an array created with 'new[]';
- is later the object of an explicit 'delete';
- is referenced anyplace after the 'delete', such as by the function which
invoked the cleaner.
  Calling the cleaner from another member function would be particularly
interesting :-)

Sometimes you can be sure that it is safe to 'delete this'. In general, it
is dangerous. 

Harald




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