]> git.sesse.net Git - mlt/blobdiff - src/modules/jackrack/plugin_mgr.c
Fix crash on audio only clip using uninialized mutex.
[mlt] / src / modules / jackrack / plugin_mgr.c
index fd8d5d6228c3b8ffbbabad0ee820b5c4913c3b9b..386cb25aca85d0e34f30ca30a86b4ca1b1341a75 100644 (file)
@@ -60,7 +60,7 @@ plugin_is_valid (const LADSPA_Descriptor * descriptor)
         ocount++;
     }
   
-  if (icount == 0 || ocount == 0)
+  if (ocount == 0)
     return FALSE;
   
   return TRUE;
@@ -80,7 +80,7 @@ plugin_mgr_get_object_file_plugins (plugin_mgr_t * plugin_mgr, const char * file
   int err;
   
   /* open the object file */
-  dl_handle = dlopen (filename, RTLD_NOW|RTLD_GLOBAL);
+  dl_handle = dlopen (filename, RTLD_NOW);
   if (!dl_handle)
     {
       mlt_log_info( NULL, "%s: error opening shared object file '%s': %s\n",
@@ -103,6 +103,13 @@ plugin_mgr_get_object_file_plugins (plugin_mgr_t * plugin_mgr, const char * file
     return;
   }
   
+#ifdef __DARWIN__
+  if (!get_descriptor (0)) {
+    void (*constructor)(void) = dlsym (dl_handle, "_init");
+    if (constructor) constructor();
+  }
+#endif
+
   plugin_index = 0;
   while ( (descriptor = get_descriptor (plugin_index)) )
     {
@@ -230,10 +237,8 @@ plugin_mgr_get_path_plugins (plugin_mgr_t * plugin_mgr)
     ladspa_path = g_strdup ("/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/lib64/ladspa");
 #endif
   
-  dir = strtok (ladspa_path, ":");
-  do
+  for (dir = strtok (ladspa_path, ":"); dir; dir = strtok (NULL, ":"))
     plugin_mgr_get_dir_plugins (plugin_mgr, dir);
-  while ((dir = strtok (NULL, ":")));
 
   g_free (ladspa_path);
 }