Skip to content

Commit bd48a2d

Browse files
committed
nemo-python-object.c: Remove the extra reference on the PyObject
file wrappers when creating the python list. PyGObjects start with a refcount of 1. Adding them to a PyList adds a second - which it removes during the list's destruction. The additional ref was also keeping its associated NemoFile from ever being finalized. ref: linuxmint/nemo#2623
1 parent d9f6622 commit bd48a2d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nemo-python/src/nemo-python-object.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ static GObjectClass *parent_class;
6666
py_files = PyList_New(0); \
6767
for (l = files; l; l = l->next) \
6868
{ \
69-
PyList_Append(py_files, pygobject_new((GObject*)l->data)); \
69+
PyObject *item = pygobject_new ((GObject *)l->data); \
70+
PyList_Append(py_files, item); \
71+
Py_DECREF (item); \
7072
} \
7173
}
7274

@@ -207,6 +209,7 @@ nemo_python_object_get_property_pages (NemoPropertyPageProvider *provider,
207209
HANDLE_LIST(py_ret, NemoPropertyPage, "Nemo.PropertyPage");
208210

209211
beach:
212+
free_pygobject_data_list (files);
210213
Py_XDECREF(py_ret);
211214
pyg_gil_state_release(state);
212215
return ret;
@@ -255,6 +258,7 @@ nemo_python_object_get_widget (NemoLocationWidgetProvider *provider,
255258
ret = (GtkWidget *)g_object_ref(py_ret_gobj->obj);
256259

257260
beach:
261+
Py_XDECREF(py_uri);
258262
Py_XDECREF(py_ret);
259263
pyg_gil_state_release(state);
260264
return ret;

0 commit comments

Comments
 (0)