<?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>82992</bug_id>
          
          <creation_ts>2012-04-02 18:38:26 -0700</creation_ts>
          <short_desc>[Qt] Crash in ~GraphicsContext3D() when init failed</short_desc>
          <delta_ts>2012-04-03 18:44:31 -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>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Srikumar B">srikumar.b</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>luiz</cc>
    
    <cc>srikumar.b</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>594118</commentid>
    <comment_count>0</comment_count>
    <who name="Srikumar B">srikumar.b</who>
    <bug_when>2012-04-02 18:38:26 -0700</bug_when>
    <thetext>webkit crashes while destructing GraphicsContext3D object when the init failed in GraphicsContext3D constructor.

We are trying to access and deallocate member variables which are never been allocated when constructor init failed in Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp


Here is the backtrack for the crash

#0  0xb62bcc76 in WTF::OwnPtr&lt;WebCore::GraphicsContext3DPrivate&gt;::operator-&gt; (this=0x8e1bad8) at ../../../../Source/WTF/wtf/OwnPtr.h:64
#1  0xb62bc392 in WebCore::GraphicsContext3D::makeContextCurrent (this=0x8e1b9c8) at ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:390
#2  0xb62bc11e in WebCore::GraphicsContext3D::~GraphicsContext3D (this=0x8e1b9c8, __in_chrg=&lt;value optimized out&gt;) at ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:351
#3  0xb62ab55b in WTF::RefCounted&lt;WebCore::GraphicsContext3D&gt;::deref (this=0x8e1b9c8) at ../../../../Source/WTF/wtf/RefCounted.h:190
#4  0xb62a9657 in WTF::derefIfNotNull&lt;WebCore::GraphicsContext3D&gt; (ptr=0x8e1b9c8) at ../../../../Source/WTF/wtf/PassRefPtr.h:52
#5  0xb62a6f21 in WTF::RefPtr&lt;WebCore::GraphicsContext3D&gt;::~RefPtr (this=0xbfffd42c, __in_chrg=&lt;value optimized out&gt;) at ../../../../Source/WTF/wtf/RefPtr.h:58
#6  0xb62bba0e in WebCore::GraphicsContext3D::create (attrs=..., hostWindow=0x82a3d20, renderStyle=WebCore::GraphicsContext3D::RenderOffscreen) at ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:243
#7  0xb629032b in WebCore::WebGLRenderingContext::create (canvas=0x8e1df90, attrs=0x8e1b5a0) at ../../../../Source/WebCore/html/canvas/WebGLRenderingContext.cpp:409
#8  0xb5b5427d in WebCore::HTMLCanvasElement::getContext (this=0x8e1df90, type=..., attrs=0x8e1b5a0) at ../../../../Source/WebCore/html/HTMLCanvasElement.cpp:202
#9  0xb57463ea in WebCore::JSHTMLCanvasElement::getContext (this=0xa7a59e40, exec=0xa88672a8) at ../../../../Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp:75
#10 0xb647cbee in WebCore::jsHTMLCanvasElementPrototypeFunctionGetContext (exec=0xa88672a8) at generated/JSHTMLCanvasElement.cpp:208
#11 0xa7e7b309 in ?? ()
#12 0xb6789e29 in JSC::JITCode::execute (this=0xa7f210b0, registerFile=0x8497ba4, callFrame=0xa8867038, globalData=0x82f0258) at ../../../../Source/JavaScriptCore/jit/JITCode.h:127
#13 0xb6786a48 in JSC::Interpreter::execute (this=0x8497b98, program=0xa7f210a0, callFrame=0xa7fffcb4, scopeChain=0xa7fdffe0, thisObj=0xa803ffc0) at ../../../../Source/JavaScriptCore/interpreter/Interpreter.cpp:1198
#14 0xb6845f44 in JSC::evaluate (exec=0xa7fffcb4, scopeChain=0xa7fdffe0, source=..., thisValue=..., returnedException=0xbfffe1b4) at ../../../../Source/JavaScriptCore/runtime/Completion.cpp:73
#15 0xb575012e in WebCore::JSMainThreadExecState::evaluate (exec=0xa7fffcb4, chain=0xa7fdffe0, source=..., thisValue=..., exception=0xbfffe1b4) at ../../../../Source/WebCore/bindings/js/JSMainThreadExecState.h:76
#16 0xb577e495 in WebCore::ScriptController::evaluateInWorld (this=0x82ee478, sourceCode=..., world=0x84980c8) at ../../../../Source/WebCore/bindings/js/ScriptController.cpp:145
#17 0xb577e5ca in WebCore::ScriptController::evaluate (this=0x82ee478, sourceCode=...) at ../../../../Source/WebCore/bindings/js/ScriptController.cpp:162
#18 0xb5a32933 in WebCore::ScriptElement::executeScript (this=0x870add8, sourceCode=...) at ../../../../Source/WebCore/dom/ScriptElement.cpp:290
#19 0xb5a322a5 in WebCore::ScriptElement::prepareScript (this=0x870add8, scriptStartPosition=..., supportLegacyTypes=WebCore::ScriptElement::DisallowLegacyTypeInTypeAttribute) at ../../../../Source/WebCore/dom/ScriptElement.cpp:235
#20 0xb5bf026d in WebCore::HTMLScriptRunner::runScript (this=0x82c6468, script=0x870ad98, scriptStartPosition=...) at ../../../../Source/WebCore/html/parser/HTMLScriptRunner.cpp:296</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>594130</commentid>
    <comment_count>1</comment_count>
      <attachid>135255</attachid>
    <who name="Srikumar B">srikumar.b</who>
    <bug_when>2012-04-02 18:57:58 -0700</bug_when>
    <thetext>Created attachment 135255
proposed patch to fix the crash in qt port

The changes fix the crash issue when GraphicsContext3D init fails for Qt port</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>595119</commentid>
    <comment_count>2</comment_count>
      <attachid>135255</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-04-03 18:44:27 -0700</bug_when>
    <thetext>Comment on attachment 135255
proposed patch to fix the crash in qt port

Clearing flags on attachment: 135255

Committed r113123: &lt;http://trac.webkit.org/changeset/113123&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>595120</commentid>
    <comment_count>3</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-04-03 18:44:31 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>135255</attachid>
            <date>2012-04-02 18:57:58 -0700</date>
            <delta_ts>2012-04-03 18:44:27 -0700</delta_ts>
            <desc>proposed patch to fix the crash in qt port</desc>
            <filename>82992.patch</filename>
            <type>text/plain</type>
            <size>1968</size>
            <attacher name="Srikumar B">srikumar.b</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDExMjk3MikKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDIyIEBACisyMDEyLTA0LTAyICBTcmlrdW1h
ciBCb25kYSAgPHNyaWt1bWFyLmJAZ21haWwuY29tPgorCisgICAgICAgIFtRdF0gQ3Jhc2ggaW4g
fkdyYXBoaWNzQ29udGV4dDNEKCkgd2hlbiBpbml0IGZhaWxlZAorICAgICAgICBodHRwczovL2J1
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