gst/gstmodule.c: Make gst-python not hang on import when embedded.
authorZaheer Abbas Merali <zaheerabbas@merali.org>
Sun, 10 Oct 2004 20:49:27 +0000 (20:49 +0000)
committerZaheer Abbas Merali <zaheerabbas@merali.org>
Sun, 10 Oct 2004 20:49:27 +0000 (20:49 +0000)
Original commit message from CVS:
2004-10-10  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

* gst/gstmodule.c: (init_gst):
Make gst-python not hang on import when embedded.
Fixes bug #155041

ChangeLog
gst/gstmodule.c

index c212b7b..8c81e6f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-10  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
+
+       * gst/gstmodule.c: (init_gst):
+       Make gst-python not hang on import when embedded.
+       Fixes bug #155041
+
 2004-10-04  Johan Dahlin  <johan@gnome.org>
 
        * gst/interfaces.defs: Add proper fiels to GstTunerNorm. Also
index 3f24dd8..6cfefb9 100644 (file)
@@ -69,7 +69,6 @@ init_gst (void)
      char **argv;
 
      init_pygobject ();
-     
      /* pull in arguments */
      av = PySys_GetObject ("argv");
      if (av != NULL) {
@@ -78,10 +77,11 @@ init_gst (void)
          for (i = 0; i < argc; i++)
               argv[i] = g_strdup (PyString_AsString (PyList_GetItem (av, i)));
      } else {
-         argc = 0;
-         argv = NULL;
+          /* gst_init_check does not like argc == 0 */
+         argc = 1;
+         argv = g_new (char *, argc);
+         argv[0] = g_strdup("");
      }
-     
      if (!gst_init_check (&argc, &argv)) {
          if (argv != NULL) {
               for (i = 0; i < argc; i++)
@@ -96,7 +96,7 @@ init_gst (void)
               g_free (argv[i]);
          g_free (argv);
      }
-     
+
      m = Py_InitModule ("_gst", pygst_functions);
      d = PyModule_GetDict (m);