pygobject r976 - in trunk: . glib



Author: paulp
Date: Wed Dec  3 19:45:41 2008
New Revision: 976
URL: http://svn.gnome.org/viewvc/pygobject?rev=976&view=rev

Log:
2008-12-03  Paul Pogonyshev  <pogonyshev gmx net>

	* glib/pyglib.c (pyglib_error_check): Test if `domain' is not-null
	before using it (avoids segfaults, see bug #561826).


Modified:
   trunk/ChangeLog
   trunk/glib/pyglib.c

Modified: trunk/glib/pyglib.c
==============================================================================
--- trunk/glib/pyglib.c	(original)
+++ trunk/glib/pyglib.c	Wed Dec  3 19:45:41 2008
@@ -270,9 +270,14 @@
     }
 
     exc_instance = PyObject_CallFunction(exc_type, "z", (*error)->message);
-    PyObject_SetAttrString(exc_instance, "domain",
-			   d=_PyUnicode_FromString(g_quark_to_string((*error)->domain)));
-    Py_DECREF(d);
+
+    if ((*error)->domain) {
+	PyObject_SetAttrString(exc_instance, "domain",
+			       d=_PyUnicode_FromString(g_quark_to_string((*error)->domain)));
+	Py_DECREF(d);
+    }
+    else
+	PyObject_SetAttrString(exc_instance, "domain", Py_None);
 
     PyObject_SetAttrString(exc_instance, "code",
 			   d=_PyLong_FromLong((*error)->code));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]