After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 345754 - Nautilus gives warnings on exit when subclassing
Nautilus gives warnings on exit when subclassing
Status: RESOLVED FIXED
Product: nautilus-python
Classification: Other
Component: general
0.4.x
Other Linux
: Normal normal
: ---
Assigned To: Johan (not receiving bugmail) Dahlin
Johan (not receiving bugmail) Dahlin
Depends on: 346401
Blocks:
 
 
Reported: 2006-06-23 14:38 UTC by Bryan Forbes
Modified: 2006-07-02 15:48 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14



Description Bryan Forbes 2006-06-23 14:38:31 UTC
When I have nautilus-python installed and I open and close a folder in spatial mode, that folder's icon stays at the open icon.  This doesn't occur when nautilus-python isn't installed.  I also get these warnings when I close a nautilus session:

--- Hash table keys for warning below:
--> file:///home/bryan
--> file:///home/bryan/svn
--> file:///home/bryan/svn/dojo/demos
--> file:///home/bryan/svn/dojo

(nautilus:10121): Eel-WARNING **: "nautilus-metafile.c: metafiles" hash table still has 4 elements at quit time (keys above)

--- Hash table keys for warning below:
--> file:///home/bryan
--> file:///home/bryan/svn
--> file:///home/bryan/svn/dojo/demos
--> file:///home/bryan/svn/dojo

(nautilus:10121): Eel-WARNING **: "nautilus-directory.c: directories" hash table still has 4 elements at quit time (keys above)
Comment 1 Bryan Forbes 2006-06-30 17:56:13 UTC
I have figured out that this only happens when a python extension has a class within it that extends one of the nautilus-python classes.  This small code sample does not cause the hash warning:

import gtk
import nautilus

class Test:
    def __init__(self):
        pass

But this does:

import gtk
import nautilus

class Test(nautilus.InfoProvider):
    def __init__(self):
        pass

    def update_file_info(self, file):
        return
Comment 2 Bryan Forbes 2006-06-30 18:59:52 UTC
If you subclass and don't override any methods of the parent class, like so:

import gtk
import nautilus

class Test(nautilus.InfoProvider):
    def __init__(self):
        pass

you don't get the warning output.  The warnings may come because the NautilusFileInfo structures aren't getting free'd correctly.
Comment 3 Gustavo Carneiro 2006-07-01 22:47:01 UTC
The bug is caused by this code in nautilus_python_object_get_file_items:

py_ret = PyObject_CallMethod(object->instance, METHOD_PREFIX METHOD_NAME,
	 "(NN)", pygobject_new((GObject *)window), py_files);

The pygobject_new(window) is causing the leak _if_ window->ref_count == 1.  At first it looked something similar to bug 344876, but bailing out early if floating == FALSE doesn't make any difference.  I have no idea how to fix this :-/
Comment 4 Gustavo Carneiro 2006-07-02 15:48:37 UTC
Looks like calling Py_Finalize() takes care of this leak.  Fixed in n-p HEAD, but needs a nautilus patch.