<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>44324</bug_id>
          
          <creation_ts>2010-08-20 00:35:46 -0700</creation_ts>
          <short_desc>[Qt] Initialize GDK before loading plugins</short_desc>
          <delta_ts>2011-04-19 05:15:29 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Plug-ins</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Qt, QtTriaged</keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andreas Kling">kling</reporter>
          <assigned_to name="QtWebKit Unassigned">webkit-qt-unassigned</assigned_to>
          <cc>adawit</cc>
    
    <cc>ademar</cc>
    
    <cc>girish</cc>
    
    <cc>hausmann</cc>
    
    <cc>kenneth</cc>
    
    <cc>vestbo</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>267156</commentid>
    <comment_count>0</comment_count>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-08-20 00:35:46 -0700</bug_when>
    <thetext>Adobe&apos;s Flash plugin has a tendency to crash and freeze here &amp; there.
We can alleviate some of this by making sure GDK is initialized before loading the plugin.
This would replace the section calling gtk_init() in PluginPackageQt.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267157</commentid>
    <comment_count>1</comment_count>
      <attachid>64931</attachid>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-08-20 00:36:58 -0700</bug_when>
    <thetext>Created attachment 64931
Proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267158</commentid>
    <comment_count>2</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2010-08-20 00:38:16 -0700</bug_when>
    <thetext>Attachment 64931 did not pass style-queue:

Failed to run &quot;[&apos;WebKitTools/Scripts/check-webkit-style&apos;]&quot; exit_code: 1
WebCore/plugins/qt/PluginPackageQt.cpp:107:  gdk_init_check is incorrectly named. Don&apos;t use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267159</commentid>
    <comment_count>3</comment_count>
    <who name="Girish Ramakrishnan">girish</who>
    <bug_when>2010-08-20 00:46:53 -0700</bug_when>
    <thetext>LGTM other than the style fixes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267164</commentid>
    <comment_count>4</comment_count>
      <attachid>64931</attachid>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-08-20 01:12:15 -0700</bug_when>
    <thetext>Comment on attachment 64931
Proposed patch

Clearing flags on attachment: 64931

Committed r65728: &lt;http://trac.webkit.org/changeset/65728&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267165</commentid>
    <comment_count>5</comment_count>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-08-20 01:12:26 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267590</commentid>
    <comment_count>6</comment_count>
    <who name="Dawit A.">adawit</who>
    <bug_when>2010-08-21 12:01:55 -0700</bug_when>
    <thetext>Now I get more frequent and random flash related crashes than before. Why was the change necessary ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267604</commentid>
    <comment_count>7</comment_count>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-08-21 13:48:56 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; Now I get more frequent and random flash related crashes than before. Why was the change necessary ?

Derp! It was freezing immediately when going to e.g http://translate.google.no/ and typing something in the text box. A number of people confirmed that this fixed it for them.

Problem was that we couldn&apos;t resolve &quot;gtk_init&quot; from the loaded plugin. The suggestion to use gdk_init() instead of gtk_init() was from Girish.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267703</commentid>
    <comment_count>8</comment_count>
    <who name="Girish Ramakrishnan">girish</who>
    <bug_when>2010-08-22 11:17:51 -0700</bug_when>
    <thetext>Mmm, I don&apos;t understand how this patch solves translate.google.no freeze.

The initial code invoked gtk_init. This presumably solves the problem that Flash assumes that gtk_init has already been called by the browser.

The fix here was made for Flash that was loaded through nspluginwraper. nspluginwrapper does not depend on gtk or gdk and hence code that we had didn&apos;t call gtk_init. We made it now call gdk_init and some problem is solved (I don&apos;t know what exactly it solved other than translate.google.no freezing).

I checked nspluginwrapper code and the thing is it does&apos;t use gtk or gdk. It loads Flash in a separate process and communicates using IPC. If anything, we should call gtk/gdk_init in that _new_ process. How does calling gtk/gdk_init in the browser help here? Obviously, it seems to help since it seems to fix the freeze but I fail to see how :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267741</commentid>
    <comment_count>9</comment_count>
    <who name="Dawit A.">adawit</who>
    <bug_when>2010-08-22 20:48:02 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; Mmm, I don&apos;t understand how this patch solves translate.google.no freeze.

Neither do I... Specially since I tried that site with the previous fix many times and in different ways and I still was not able to get it to freeze on me.

&gt; The initial code invoked gtk_init. This presumably solves the problem that Flash assumes that gtk_init has already been called by the browser.

Actually without that patch the new 10.1 series of flash player plugins from Adobe simply crash when used from a non-Gtk application. You can see the gory details in http://webkit.org/b/40567. This however is not the first time Adobe&apos;s releases have caused this particular issue. There were similar problems in some versions of of previous releases as well. That is why there are workarounds rendering engines and browsers that do not rely on Gtk, e.g. khtml &amp; opera.

&gt; The fix here was made for Flash that was loaded through nspluginwraper. nspluginwrapper does not depend on gtk or gdk and hence code that we had 
&gt; didn&apos;t call gtk_init. We made it now call gdk_init and some problem is solved (I don&apos;t know what exactly it solved other than translate.google.no 
&gt; freezing).
&gt;
&gt; I checked nspluginwrapper code and the thing is it does&apos;t use gtk or gdk. It loads Flash in a separate process and communicates using IPC. If 
&gt; anything, we should call gtk/gdk_init in that _new_ process. How does calling gtk/gdk_init in the browser help here? Obviously, it seems to help since 
&gt; it seems to fix the freeze but I fail to see how :)

Ahhh... I now see where the entire misunderstanding is coming from. You guys are looking at this issue from the prespective of using the nspluginwrapper which is completely different from using the Adobe flash player plugin directly! Obviously, in the case of the nspluginwrapper the attempt to resolve the &quot;gtk_init&quot; symbol from the library will fail unless of course it uses Gtk, which as you stated above is not the case. 

So then can we safely say that the problem with the original patch (40567) is its failure to limit the impact of the workaround to Adobe&apos;s flash player plugin only ? If that is the case, then the fix is really simple instead of what you guys did here. In fact, in addition to nspluginwrapper, this workaround should be unnecessary for other flash players like gnash and lightspark. I guess I will go ahead and open a new ticket and post my patch to address the issue discussed here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>267770</commentid>
    <comment_count>10</comment_count>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-08-22 23:25:45 -0700</bug_when>
    <thetext>*** Bug 35684 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>282437</commentid>
    <comment_count>11</comment_count>
    <who name="Ademar Reis">ademar</who>
    <bug_when>2010-09-21 11:06:36 -0700</bug_when>
    <thetext>Although there&apos;s some dispute on the real need of this patch, it&apos;s now part of trunk and is still marked as a candidate for webkit-2.0 (it&apos;s now too late, but anyway).

I would like to cherry-pick it to QtWebkit-2.1 (the fork was made a few commits before this patch landed). Should I? Or is there a better fix/workaround available?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>282438</commentid>
    <comment_count>12</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2010-09-21 11:07:54 -0700</bug_when>
    <thetext>yes please, we need all plugin fixes in 2.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>282493</commentid>
    <comment_count>13</comment_count>
    <who name="Ademar Reis">ademar</who>
    <bug_when>2010-09-21 12:58:50 -0700</bug_when>
    <thetext>Revision r65728 cherry-picked into qtwebkit-2.1 with commit a74784a &lt;http://gitorious.org/webkit/qtwebkit/commit/a74784a&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>64931</attachid>
            <date>2010-08-20 00:36:58 -0700</date>
            <delta_ts>2010-08-20 01:12:15 -0700</delta_ts>
            <desc>Proposed patch</desc>
            <filename>bug-44324.diff</filename>
            <type>text/plain</type>
            <size>3432</size>
            <attacher name="Andreas Kling">kling</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
MjE4ZGQ3YS4uNjc5Y2M1ZiAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxNyBAQAorMjAxMC0wOC0yMCAgQW5kcmVhcyBLbGlu
ZyAgPGFuZHJlYXMua2xpbmdAbm9raWEuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9E
WSAoT09QUyEpLgorCisgICAgICAgIFtRdF0gSW5pdGlhbGl6ZSBHREsgYmVmb3JlIGxvYWRpbmcg
cGx1Z2lucworICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9
NDQzMjQKKworICAgICAgICBBdHRlbXB0IHRvIGNhbGwgZ2RrX2luaXRfY2hlY2soKSBiZWZvcmUg
bG9hZGluZyBhbnkg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oZSBHdGsKLSAgICAgICAgLy8gaGFuZGxlcnMgYWJvcnQgd2hl
biB0aGV5IHJlY2VpdmUgYW4gWCBlcnJvciwgdGh1cyBraWxsaW5nIHRoZSB2aWV3ZXIuCi0jaWZk
ZWYgUV9XU19YMTEKLSAgICAgICAgaW50ICgqb2xkX2Vycm9yX2hhbmRsZXIpKERpc3BsYXkqLCBY
RXJyb3JFdmVudCopID0gWFNldEVycm9ySGFuZGxlcigwKTsKLSAgICAgICAgaW50ICgqb2xkX2lv
X2Vycm9yX2hhbmRsZXIpKERpc3BsYXkqKSA9IFhTZXRJT0Vycm9ySGFuZGxlcigwKTsKLSNlbmRp
ZgotICAgICAgICBndGtJbml0KDAsIDApOwotI2lmZGVmIFFfV1NfWDExCi0gICAgICAgIFhTZXRF
cnJvckhhbmRsZXIob2xkX2Vycm9yX2hhbmRsZXIpOwotICAgICAgICBYU2V0SU9FcnJvckhhbmRs
ZXIob2xkX2lvX2Vycm9yX2hhbmRsZXIpOwotI2VuZGlmCi0gICAgfQorICAgIC8vIFRyeSB0byBp
bml0aWFsaXplIEdESyAtIHNvbWUgdmVyc2lvbnMgb2YgdGhlIEZsYXNoIHBsdWdpbiBkZXBlbmQg
b24gdGhpcy4KKyAgICBpbml0aWFsaXplR2RrSWZQb3NzaWJsZSgpOwogCiAjaWYgZGVmaW5lZChY
UF9VTklYKQogICAgIG5wRXJyID0gTlBfSW5pdGlhbGl6ZSgmbV9icm93c2VyRnVuY3MsICZtX3Bs
dWdpbkZ1bmNzKTsK
</data>

          </attachment>
      

    </bug>

</bugzilla>