开发者

QtBrowserPlugin crash when I nest other plugin into it: is my fix correct?

There is QtBrowserPlugin which contains QWebView that load a page that contains other plugin.

(opera 
    (some_page 
        (my_qtbrowser_plugin 
            (QWebView 
                (some_other_page 
                    (some_other_plugin))))))

Why after loading a page which loads or attempts to load some other plugin it stops dispatching events to the QtBrowserPlugin (crashes on any JS call from the outside: http://sprunge.us/HeZA)

In the stacktrace I see:

#3  <signal handler called>
#4  0xb63ae1f2 in WebCore::IdentifierRep::string() const () from /usr/local/Trolltech/Qt-4.7.0/lib/libQtWebKit.so.4
#5  0xb63b339c in _NPN_UTF8FromIdentifier () from /usr/local/Trolltech/Qt-4.7.0/lib/libQtWebKit.so.4
#6  0xb76e3d51 in NPN_UTF8FromIdentifier (identifier=0x7ffffffe) at .../src/qtbrowserplugin.cpp:200
#7  0xb76e4aaf in NPClass_HasMethod (npobj=0x80e5c80, name=0x7ffffffe) at .../src/qtbrowserplugin.cpp:364

Why the code in qtbrowserplugin calls things in QtWebKit? Are there any other ideas how to debug/fix it?

Update I've also just found that it calls qtbrowserplugin.cpp:NP_Initialize twice ( http://sprunge.us/BdfQ ):

*** GDB BACKTRACE ***
#2  0xb78ad817 in NP_Initialize (nFuncs=0x807599c, pFuncs=0x8074740) at /mnt/sda8/src/p/qtbrowserplugin-2.4_1-opensource/src/qtbrowserplugin.cpp:1273
#3  0x080556ea in Handle::Open(char const*, _NPNetscapeFuncs*) ()
#4  0x08056692 in pluginController::open(char const*) ()
#5  0x08055ca8 in main ()
*** END OF BACKTRACE ***
** (operapluginwrapper:1281): DEBUG: NP_Initialize
** (operapluginwrapper:1281): DEBUG: NP_Initialize succeeded

*** GDB BACKTRACE ***
#2  0xb78ad817 in NP_Initialize (nFuncs=0xb4357094, pFuncs=0xb4357058) at /mnt/sda8/src/p/qtbrowserplugin-2.4_1-opensource/src/qtbrowserplugin.cpp:
#3  0xb6af7dae in WebCore::PluginPackage::load() () from /usr/local/Trolltech/Qt-4.7.0/lib/libQtWebKit.so.4
#4  0xb6af774d in WebCore::PluginPackage::fetchInfo() () from /usr/local/Trolltech/Qt-4.7.0/lib/libQtWebKit.so.4
#5  0xb69578ae in WebCore::PluginPackage::createPackage(WebCore::String const&, long const&) () from /usr/local/Trolltech/Qt-4.7.0/lib/libQtWebKit.so.4
...

Update 2 Is my fix c开发者_开发技巧orrect? http://vi-server.org/vi/bin/qtbrowserplugin-2.4_1-opensource-netsing-fix.patch :

diff --git a/qtbrowserplugin-2.4_1-opensource.orig/src/qtbrowserplugin.cpp b/qtbrowserplugin-2.4_1-opensource/src/qtbrowserplugin.cpp
index e7c6f31..632d546 100644
--- a/qtbrowserplugin-2.4_1-opensource.orig/src/qtbrowserplugin.cpp
+++ b/qtbrowserplugin-2.4_1-opensource/src/qtbrowserplugin.cpp
@@ -1271,6 +1271,10 @@ extern "C" NPError WINAPI NP_Initialize(NPNetscapeFuncs* nFuncs, NPPluginFuncs*
 {
     if(!nFuncs)
         return NPERR_INVALID_FUNCTABLE_ERROR;
+    
+    if(qNetscapeFuncs) {
+        return NPERR_INVALID_PLUGIN_ERROR;
+    }

     qNetscapeFuncs = nFuncs;
     int navMajorVers = qNetscapeFuncs->version >> 8;


For the full-screen requirement it's a bit tricky to suggest sensible solutions without more details. For layering plugins however you should look into windowless plugins (i don't know whether QtBrowserPlugin supports them, FireBreath should support them in the next release).

I don't think you can actually fix the problem - both browser engines load your plugin as a shared library and get the same instance due to being in the same process. Now they both want to call NP_Initialize() to exchange function pointers, which makes it impossible for you to talk to both browsers:
You could store the separate NPNetspaceFuncs, but you can't (without major hacks) detect which browser actually calls NPP_New() etc. and thus not determine which browser you should call back from which plugin.

A hacky workaround might be to actually use two different plugins, one for each browser engine. Keep in mind however that you can break other plugins too if you use them in both.
Another alternative for your fullscreen problem might be to invoke a seperate process, which gives you full control over GUI elements.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜