Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 85256dcd146fe7c962af943a0bcdba76 > files > 1

icedtea-web-1.1.6-1.mga1.src.rpm

--- icedtea-web-1.0.2/plugin/icedteanp/IcedTeaNPPlugin.cc.orig	2011-05-24 20:27:00.262268990 -0300
+++ icedtea-web-1.0.2/plugin/icedteanp/IcedTeaNPPlugin.cc	2011-05-24 20:27:38.473423286 -0300
@@ -413,7 +413,9 @@ void start_jvm_if_needed()
   // This is asynchronized function. It must
   // have exclusivity when running.
 
-  GMutex *vm_start_mutex = g_mutex_new();
+  static GMutex *vm_start_mutex;
+  if (vm_start_mutex == NULL)
+    vm_start_mutex = g_mutex_new();
   g_mutex_lock(vm_start_mutex);
 
   PLUGIN_DEBUG("Checking JVM status...\n");
@@ -422,6 +424,7 @@ void start_jvm_if_needed()
   if (jvm_up)
   {
       PLUGIN_DEBUG("JVM is up. Returning.\n");
+      g_mutex_unlock(vm_start_mutex);
       return;
   }
 
--- icedtea-web-1.0.2/plugin/icedteanp/IcedTeaPluginUtils.cc.orig	2011-05-24 20:27:56.375495784 -0300
+++ icedtea-web-1.0.2/plugin/icedteanp/IcedTeaPluginUtils.cc	2011-05-24 20:28:34.609651056 -0300
@@ -1033,6 +1033,7 @@ MessageBus::post(const char* message)
 
 	PLUGIN_DEBUG("Trying to lock %p...\n", &msg_queue_mutex);
 	pthread_mutex_lock(&subscriber_mutex);
+	pthread_mutex_lock(&msg_queue_mutex);
 
     PLUGIN_DEBUG("Message %s received on bus. Notifying subscribers.\n", msg);
 
@@ -1042,10 +1043,14 @@ MessageBus::post(const char* message)
     	message_consumed = ((BusSubscriber*) *i)->newMessageOnBus(msg);
     }
 
-    pthread_mutex_unlock(&subscriber_mutex);
+     pthread_mutex_unlock(&msg_queue_mutex);
+     pthread_mutex_unlock(&subscriber_mutex);
 
-    if (!message_consumed)
+    if (!message_consumed) {
     	PLUGIN_DEBUG("Warning: No consumer found for message %s\n", msg);
+	/* no subscribers */
+	free(msg);
+    }
 
     PLUGIN_DEBUG("%p unlocked...\n", &msg_queue_mutex);
 }