[pygobject3/f18] fix rhythmbox crash f# x86_64/

Ray Strode rstrode at fedoraproject.org
Wed Dec 19 18:29:20 UTC 2012


commit 14e44ae5618044ff20fc90d449a507384c30a7c1
Author: Ray Strode <rstrode at redhat.com>
Date:   Wed Dec 19 13:23:11 2012 -0500

    fix rhythmbox crash
    f#	x86_64/

 fix-rhythmbox.patch |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++
 pygobject3.spec     |   12 +++++-
 2 files changed, 119 insertions(+), 1 deletions(-)
---
diff --git a/fix-rhythmbox.patch b/fix-rhythmbox.patch
new file mode 100644
index 0000000..b91f674
--- /dev/null
+++ b/fix-rhythmbox.patch
@@ -0,0 +1,108 @@
+From 3bfdd4ac80d3eaccdf2b3ae4c4386bf953c58507 Mon Sep 17 00:00:00 2001
+From: Ray Strode <rstrode at redhat.com>
+Date: Wed, 19 Dec 2012 13:04:32 -0500
+Subject: [PATCH] pyg_value_from_pyobject: support GArray
+
+This commit adds support for marshalling
+a python list (or other sequence) returned
+from signal handlers to GArray, if necessary.
+
+This parallels the implementation written
+to marshal to (the now deprecated) GValueArray.
+
+This fixes a crash in rhythmbox as seen downstream here:
+
+https://bugzilla.redhat.com/show_bug.cgi?id=872851
+
+https://bugzilla.gnome.org/show_bug.cgi?id=690514
+---
+ gi/_gobject/pygtype.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 63 insertions(+), 3 deletions(-)
+
+diff --git a/gi/_gobject/pygtype.c b/gi/_gobject/pygtype.c
+index 79c8387..89b1ace 100644
+--- a/gi/_gobject/pygtype.c
++++ b/gi/_gobject/pygtype.c
+@@ -727,6 +727,63 @@ pyg_value_array_from_pyobject(GValue *value,
+     return 0;
+ }
+ 
++static int
++pyg_array_from_pyobject(GValue *value,
++		        PyObject *obj)
++{
++    int len;
++    GArray *array;
++    int i;
++
++    len = PySequence_Length(obj);
++    if (len == -1) {
++	PyErr_Clear();
++	return -1;
++    }
++
++    array = g_array_new(FALSE, TRUE, sizeof(GValue));
++
++    for (i = 0; i < len; ++i) {
++	PyObject *item = PySequence_GetItem(obj, i);
++	GType type;
++	GValue item_value = { 0, };
++	int status;
++
++	if (! item) {
++	    PyErr_Clear();
++	    g_array_free(array, FALSE);
++	    return -1;
++	}
++
++	if (item == Py_None)
++	    type = G_TYPE_POINTER; /* store None as NULL */
++	else {
++	    type = pyg_type_from_object((PyObject*)Py_TYPE(item));
++	    if (! type) {
++		PyErr_Clear();
++		g_array_free(array, FALSE);
++		Py_DECREF(item);
++		return -1;
++	    }
++	}
++
++	g_value_init(&item_value, type);
++	status = pyg_value_from_pyobject(&item_value, item);
++	Py_DECREF(item);
++
++	if (status == -1) {
++	    g_array_free(array, FALSE);
++	    g_value_unset(&item_value);
++	    return -1;
++	}
++
++	g_array_append_val(array, item_value);
++    }
++
++    g_value_take_boxed(value, array);
++    return 0;
++}
++
+ /**
+  * pyg_value_from_pyobject:
+  * @value: the GValue object to store the converted value in.
+@@ -956,9 +1013,12 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj)
+             g_value_take_boxed (value, n_value);
+             return pyg_value_from_pyobject (n_value, obj);
+         }
+-        else if (PySequence_Check(obj) &&
+-		   G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY))
+-	    return pyg_value_array_from_pyobject(value, obj, NULL);
++        else if (PySequence_Check(obj)) {
++	    if (G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY))
++	        return pyg_value_array_from_pyobject(value, obj, NULL);
++	    if (G_VALUE_HOLDS(value, G_TYPE_ARRAY))
++	        return pyg_array_from_pyobject(value, obj);
++	}
+ 	else if (PYGLIB_PyUnicode_Check(obj) &&
+                  G_VALUE_HOLDS(value, G_TYPE_GSTRING)) {
+             GString *string;
+-- 
+1.8.0.2
+
diff --git a/pygobject3.spec b/pygobject3.spec
index 339bfb9..c7754cf 100644
--- a/pygobject3.spec
+++ b/pygobject3.spec
@@ -21,7 +21,7 @@
 ### Abstract ###
 
 Name: pygobject3
-Version: 3.4.2
+Version: 3.7.2
 Release: 4%{?dist}
 License: LGPLv2+ and MIT
 Group: Development/Languages
@@ -79,6 +79,11 @@ Patch6: gdk-atom-2.patch
 # upstream fix for arrays of struct pointers
 Patch7: struct-pointers.patch
 
+# https://bugzilla.gnome.org/show_bug.cgi?id=690514
+# https://bugzilla.redhat.com/show_bug.cgi?id=872851
+# rhythmbox crash
+Patch8: fix-crash.patch
+
 ### Build Dependencies ###
 
 BuildRequires: chrpath
@@ -164,6 +169,7 @@ for use in Python 3 programs.
 %patch5 -p1 -b .atom1
 %patch6 -p1 -b .atom2
 %patch7 -p1 -b .struct-pointers
+%patch8 -p1 -b .fix-rhythmbox
 
 %if 0%{?with_python3}
 rm -rf %{py3dir}
@@ -275,6 +281,10 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
 %endif # with_python3
 
 %changelog
+* Wed Dec 19 2012 Ray Strode <rstrode at redhat.com> 3.7.2-4
+- Fix rhythmbox crash
+  Resolves: #872851
+
 * Thu Dec 13 2012 Ray Strode <rstrode at redhat.com> 3.7.1-3
 - Split non-cairo parts into a subpackage
 


More information about the scm-commits mailing list