Blob Blame History Raw
--- gnome-menus-2.18.0/python/gmenu.c~	2007-03-12 14:49:27.000000000 -0400
+++ gnome-menus-2.18.0/python/gmenu.c	2007-06-05 19:55:37.000000000 -0400
@@ -1497,6 +1497,9 @@
 {
   PyObject *args;
   PyObject *ret;
+  PyGILState_STATE gstate;
+
+  gstate = PyGILState_Ensure();
 
   args = PyTuple_New (callback->user_data ? 2 : 1);
 
@@ -1513,6 +1516,8 @@
 
   Py_XDECREF (ret);
   Py_DECREF (args);
+
+  PyGILState_Release(gstate);
 }
 
 static PyObject *
@@ -1522,10 +1527,15 @@
   PyGMenuTree         *tree;
   PyGMenuTreeCallback *callback;
   PyObject            *pycallback;
-  PyObject            *pyuser_data;
+  PyObject            *pyuser_data = NULL;
 
   if (!PyArg_ParseTuple (args, "O|O:gmenu.Tree.add_monitor", &pycallback, &pyuser_data))
     return NULL;
+  if (!PyCallable_Check(pycallback))
+    {
+      PyErr_SetString(PyExc_TypeError, "callback must be callable");
+      return NULL;
+    }
 
   tree = (PyGMenuTree *) self;