GNOME Bugzilla – Bug 668563
Raise exception instead of segv when trying to access already destroyed gobjects
Last modified: 2012-04-20 13:01:43 UTC
I had a bug in one of my pygi apps that was caused by a signal emited after the main window was already destroyed. This lead to a segfault in the app. Attached is a small example that triggers the segfault. Now obviously the code there is wrong and buggy. And yet it would be nice if pygobject would have a way of raising a exception if python code tries to access a already destroyed gobject instead of segfaulting. Thanks! Michael
Created attachment 205958 [details] test case The attachment creation failed for some reason when I submitted it, here is the attachment again.
Well, I don't think that code is wrong, as long as you have a reference to its Python wrapper, the GObject should be kept alive. What we are seeing here is a missing incref, maybe a wrong annotation?
This looks like bug 674050. As the crash is in GTK, not in pygobject, there is not much we can do here anyway. The proper fix would be to disconnect all signal handlers before destroying objects, I think. *** This bug has been marked as a duplicate of bug 674050 ***