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



>> So you propose "void seen_it_clicked() { delete this; }"? Perhaps my
>> aversion stems from bad experience with older gtkmm versions and is
>> unnecessary.
>
>I do it exactly this way and it works fine. I think it's the easiest
>solution to manage non-modal dialogs and windows.

in my experience, it is extremely dangerous for many widgets, at least
in gtk+ 1.2 and its matching gtkmm version.

AFAIK, no extra reference is taken during signal emission, so the
"delete this" will delete the memory used by the widget for whom the
signal emission is taking place. most likely it works for you because
you don't have a multithreaded program or one where memory allocation
might happen after the "delete this" but before the end of signal
emission. 

deleting a widget during a signal emission is just a bad idea, IMHO.

--p



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