summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--glib/pyglib.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 26a4be0..38cd16d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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).
+
2008-10-31 John Finlay <finlay@moeraki.com>
* codegen/__init__.py (__all__): Add defsgen to __all__ list.
diff --git a/glib/pyglib.c b/glib/pyglib.c
index 4dabb19..4001708 100644
--- a/glib/pyglib.c
+++ b/glib/pyglib.c
@@ -270,9 +270,14 @@ pyglib_error_check(GError **error)
}
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));