Re: [Re: [Re: [Re: [[gtkmm] Glib::RefPtr also for Widgets?] ] ] ]
- From: Murray Cumming <murrayc usa net>
- To: Paul Davis <pbd op net>, Murray Cumming <murrayc usa net>
- Cc: Christof Petig <christof petig-baender de>, gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [Re: [Re: [Re: [[gtkmm] Glib::RefPtr also for Widgets?] ] ] ]
- Date: Tue, 24 Sep 2002 10:08:27 +0100
Paul Davis <pbd op net> wrote:
> actually, if you don't mind, i'll use theory to let you know that
> gtkmm cannot solve this. if gtk+2 doesn't take an extra reference to
> the widget in question when signal emission starts, then for any
> button_press event, "delete this" from the handler will theoretically
> cause a segfault. you may never see it, because of the way your
> program uses memory, but its technically a coding error to do
> this. the widget's lifetime needs to extend to the next button_release
> event for almost all widgets.
>
> gtkmm can't fix it because the reference has to be taken *before*
> signal emission begins. if gtkmm tried to fix it, it would be doing it
> from a proxy handler, and thus deletion would still occur once control
> returned to the proxy, before it hands back to the GTK+ code that
> expects the widget to still exist.
>
> however, it is possible that this was fixed in gtk+2 by taking the
> extra reference and removing it at the end of signal handling.
>
> the exact same behaviour occurs for a pure GTK+ program that calls
> gtk_widget_delete() from a signal handler, so its hardly a "bug" in
> gtkmm.
Theories still need to be tested with experimental results.
Murray Cumming
murrayc usa net
www.murrayc.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]