GNOME Bugzilla – Bug 460781
EoG doesn't quit when using python plugins
Last modified: 2019-02-22 03:17:13 UTC
I'm attaching my adaptation of the python console plugin, when active, eog doesn't quit.
Created attachment 92509 [details] python plugin, adapted from epiphany and gedit. When this is in use, eog doesn't quit.
Confirming. This seems to be a ref counting problem. Enabling the plugin refs EOG's main window (don't know where that comes from) which keeps the finalizer from running. Because of that we are not leaving the main loop.
s/where that comes from/where that happens
Okay, I think the general problem is that as long as an object in the python space has a reference to the window the refcount is +1 preventing the window's finalizer to run (and thus keeping eog running). The window reference that is passed to PythonConsole's constructor is enough already to produce this (the next one being the reference set in the action (if it is passed to the uimanager). So, I guess practically we have to make eog leave the mainloop (to reach the plugin cleanup) while the window is not destroyed (is this actually possible?) or at least make sure the plugin engine is shut down once we close the last window.
Looks like we have a "plugins" component now. :-) Switching to it.
This should work better with GNOME 3.0 and the libpeas-based API now. One still has to be awesomely careful not to catch an unwanted reference to the EogWindow but it's not that easy anymore.