Title: [89539] trunk/Source/WebKit2
Revision
89539
Author
carlo...@webkit.org
Date
2011-06-22 23:46:56 -0700 (Wed, 22 Jun 2011)

Log Message

2011-06-22  Carlos Garcia Campos  <cgar...@igalia.com>

        Reviewed by Martin Robinson.

        [UNIX] Increment/decrement module load conter in NetscapePluginModule::getPluginInfo()
        https://bugs.webkit.org/show_bug.cgi?id=63150

        Since the method is static, we are using
        NetscapePluginModule::getOrCreate() to get the module. If it's
        created, the load counter is 0, so that when module is deleted,
        shutdown() hasn't been called and the destructor crashes in the
        assert that checks the module has been removed from the
        initialized module list. We should increment the load counter, and
        decrement it before getPluginInfo() returns, so that
        decrementLoadCount() will call shutdown() if counter is 0 and the
        module will be deleted from the list.

        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
        (WebKit::NetscapePluginModule::getPluginInfo):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (89538 => 89539)


--- trunk/Source/WebKit2/ChangeLog	2011-06-23 06:46:55 UTC (rev 89538)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-23 06:46:56 UTC (rev 89539)
@@ -2,6 +2,26 @@
 
         Reviewed by Martin Robinson.
 
+        [UNIX] Increment/decrement module load conter in NetscapePluginModule::getPluginInfo()
+        https://bugs.webkit.org/show_bug.cgi?id=63150
+
+        Since the method is static, we are using
+        NetscapePluginModule::getOrCreate() to get the module. If it's
+        created, the load counter is 0, so that when module is deleted,
+        shutdown() hasn't been called and the destructor crashes in the
+        assert that checks the module has been removed from the
+        initialized module list. We should increment the load counter, and
+        decrement it before getPluginInfo() returns, so that
+        decrementLoadCount() will call shutdown() if counter is 0 and the
+        module will be deleted from the list.
+
+        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
+        (WebKit::NetscapePluginModule::getPluginInfo):
+
+2011-06-22  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Reviewed by Martin Robinson.
+
         [UNIX] Check for npp directly when getting X display in NetscapeBrowserFuncs
         https://bugs.webkit.org/show_bug.cgi?id=63149
 

Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp (89538 => 89539)


--- trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp	2011-06-23 06:46:55 UTC (rev 89538)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp	2011-06-23 06:46:56 UTC (rev 89539)
@@ -130,17 +130,23 @@
     if (!pluginModule)
         return false;
 
+    pluginModule->incrementLoadCount();
+
     plugin.path = pluginPath;
     plugin.info.file = pathGetFileName(pluginPath);
 
     Module* module = pluginModule->module();
     NPP_GetValueProcPtr NPP_GetValue = module->functionPointer<NPP_GetValueProcPtr>("NP_GetValue");
-    if (!NPP_GetValue)
+    if (!NPP_GetValue) {
+        pluginModule->decrementLoadCount();
         return false;
+    }
 
     NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = module->functionPointer<NP_GetMIMEDescriptionFuncPtr>("NP_GetMIMEDescription");
-    if (!NP_GetMIMEDescription)
+    if (!NP_GetMIMEDescription) {
+        pluginModule->decrementLoadCount();
         return false;
+    }
 
     char* buffer = 0;
     NPError err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer);
@@ -148,11 +154,15 @@
         plugin.info.desc = buffer;
 
     const char* mimeDescription = NP_GetMIMEDescription();
-    if (!mimeDescription)
+    if (!mimeDescription) {
+        pluginModule->decrementLoadCount();
         return false;
+    }
 
     setMIMEDescription(mimeDescription, plugin);
 
+    pluginModule->decrementLoadCount();
+
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to