On Fri, 2008-08-01 at 16:41 +0200, Bastian Winkler wrote:
> OK, the patch works on x86_64/nvidia (the system my former backtrace was
> made on), but fails on i386/intel with:
>
> ** (process:12615): WARNING **: Invalid string. This should not happen.
mmh, I might have an idea. could you please try the attached patch over
a clean SVN checkout?
> BTW, both systems are running Debian SID with python 2.5.2-9
yep, here too.
ciao,
Emmanuele.
--
Emmanuele Bassi, OpenedHand Ltd.
Unit R, Homesdale Business Centre
216-218 Homesdale Rd., Bromley - BR12QZ
http://www.o-hand.com
diff --git a/clutter-gst/cluttergstmodule.c b/clutter-gst/cluttergstmodule.c
index adcef0f..270beb8 100644
--- a/clutter-gst/cluttergstmodule.c
+++ b/clutter-gst/cluttergstmodule.c
@@ -45,10 +45,17 @@ init_clutter_gst (void)
if (av != NULL)
{
- argv = g_new (char*, argc);
+ argv = g_new0 (char*, argc + 1);
for (i = 0; i < argc; i++)
- argv[i] = g_strdup (PyString_AsString (PyList_GetItem (av, i)));
+ {
+ PyObject *arg = PyList_GetItem (av, i);
+
+ if (arg && PyString_Check (arg))
+ argv[i] = g_strdup (PyString_AsString (arg));
+ else
+ g_warning ("Invalid string. This should not happen.");
+ }
}
else
{
@@ -57,19 +64,7 @@ init_clutter_gst (void)
}
if (!clutter_gst_init (&argc, &argv))
- {
- if (argv != NULL)
- g_strfreev (argv);
-
- PyErr_SetString (PyExc_RuntimeError, "cluttergst initialization error");
-
- /* set the LC_NUMERIC locale back to "C", as Python < 2.4 requires
- * that it be set that way. */
-#if PY_VERSION_HEX < 0x020400F0
- setlocale(LC_NUMERIC, "C");
-#endif
- return;
- }
+ PyErr_SetString (PyExc_RuntimeError, "cluttergst initialization error");
/* set the LC_NUMERIC locale back to "C", as Python < 2.4 requires that
* it be set that way. */
diff --git a/clutter-gtk/cluttergtkmodule.c b/clutter-gtk/cluttergtkmodule.c
index e92c9e4..006888e 100644
--- a/clutter-gtk/cluttergtkmodule.c
+++ b/clutter-gtk/cluttergtkmodule.c
@@ -45,10 +45,17 @@ init_clutter_gtk (void)
if (av != NULL)
{
- argv = g_new (char*, argc);
+ argv = g_new0 (char*, argc + 1);
for (i = 0; i < argc; i++)
- argv[i] = g_strdup (PyString_AsString (PyList_GetItem (av, i)));
+ {
+ PyObject *arg = PyList_GetItem (av, i);
+
+ if (arg && PyString_Check (arg))
+ argv[i] = g_strdup (PyString_AsString (arg));
+ else
+ g_warning ("Invalid string object. This should not happen");
+ }
}
else
{
@@ -57,19 +64,7 @@ init_clutter_gtk (void)
}
if (!gtk_clutter_init (&argc, &argv))
- {
- if (argv != NULL)
- g_strfreev (argv);
-
- PyErr_SetString (PyExc_RuntimeError, "cluttergtk initialization error");
-
- /* set the LC_NUMERIC locale back to "C", as Python < 2.4 requires
- * that it be set that way. */
-#if PY_VERSION_HEX < 0x020400F0
- setlocale(LC_NUMERIC, "C");
-#endif
- return;
- }
+ PyErr_SetString (PyExc_RuntimeError, "cluttergtk initialization error");
/* set the LC_NUMERIC locale back to "C", as Python < 2.4 requires that
* it be set that way. */
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 10c78b1..13b10e5 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -105,3 +105,9 @@ defs_DATA = \
&& cp -f gen-$*.c $*.c \
&& rm -f gen-$*.c
+# delete the old submodules, if any, to avoid collisions
+install-data-local:
+ (cd $(DESTDIR)$(pyclutterexecdir) && \
+ rm -f cluttercairo.so && \
+ rm -f cluttergst.so && \
+ rm -f cluttergtk.so)