Re: [[gtkmm] Glib::RefPtr also for Widgets?]



Christof Petig <christof petig-baender de> wrote:
> This leads to a new question:
> How to destroy a gtkmm2 dialog within one of it's callbacks. I tried to 
> look inside the examples but got no clue [it looked to me like initial 
> allocation of a static widget and hiding/showing it - smells like a 
> widget leak]. In 1.2 this was the legitimate use for this->destroy(). I 
> even remember Gtk_Trashcan<> with horror ...
> 
> I even looked through the gtkmm2 docs, with no answer ... It sounded 
> like "delete this;" which really scares me.

It seems like "delete this" is what you want. If you just want to hide the
dialog then use hide().

Why would it be important to you to destroy the underlying C instance? We have
spent a long time ensuring that the lifetime of the C++ wrappers is tightly
bound to the lifetime of the C objects. I think it would be best to forget
about the underlying C instances whenever possible.


Murray Cumming
murrayc usa net
www.murrayc.com




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