Closed Bug 733665 Opened 8 years ago Closed 8 years ago

NS_ASSERTION failure when calling WebGL getExtension

Categories

(Core :: Canvas: WebGL, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: bjacob, Assigned: bjacob)

Details

Attachments

(1 file)

extensions are stored as nsCOMPtr<WebGLExtension>, but that makes no sense as WebGLExtension is not a XPCOM interface class (doesn't have an IID, doesn't implement nsISupports). Consequently, a NS_ASSERTION fails everytime getExtension succeeds and creates a WebGLExtension object.

###!!! ASSERTION: QueryInterface needed: 'query_result.get() == mRawPtr', file ../../../dist/include/nsCOMPtr.h, line 532

Program received signal SIGTRAP, Trace/breakpoint trap.
RealBreak () at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:422
422	}
(gdb) bt
#0  RealBreak () at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:422
#1  0x00007ffff5083070 in Break (
    aMsg=0x7fffffff96c0 "###!!! ASSERTION: QueryInterface needed: 'query_result.get() == mRawPtr', file ../../../dist/include/nsCOMPtr.h, line 532")
    at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:513
#2  0x00007ffff5083023 in NS_DebugBreak_P (aSeverity=1, 
    aStr=0x7ffff5b579b4 "QueryInterface needed", 
    aExpr=0x7ffff5b57996 "query_result.get() == mRawPtr", 
    aFile=0x7ffff5b577f8 "../../../dist/include/nsCOMPtr.h", aLine=532)
    at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:380
#3  0x00007ffff412ea07 in nsCOMPtr<mozilla::WebGLExtension>::Assert_NoQueryNeeded (
    this=0x7fffdb8934a0) at ../../../dist/include/nsCOMPtr.h:532
#4  0x00007ffff412da03 in nsCOMPtr<mozilla::WebGLExtension>::operator= (
    this=0x7fffdb8934a0, rhs=0x7fffd300b228)
    at ../../../dist/include/nsCOMPtr.h:652
#5  0x00007ffff4127beb in mozilla::WebGLContext::GetExtension (
    this=0x7fffdb893400, aName=..., retval=0x7fffffff9c30)
    at /home/bjacob/mozilla-central/content/canvas/src/WebGLContext.cpp:872
#6  0x00007ffff4961268 in nsIDOMWebGLRenderingContext_GetExtension (cx=
    0x7fffdb85c000, argc=1, vp=0x7fffe15000a8)
    at /home/bjacob/mozilla-central/obj-firefox-debug/js/xpconnect/src/dom_quickstubs.cpp:25603
#7  0x00007ffff5675e73 in js::CallJSNative (cx=0x7fffdb85c000, 
    native=0x7ffff4961057 <nsIDOMWebGLRenderingContext_GetExtension(JSContext*, unsi---Type <return> to continue, or q <return> to quit---
gned int, jsval*)>, args=...)
    at /home/bjacob/mozilla-central/js/src/jscntxtinlines.h:314
#8  0x00007ffff565d8eb in js::InvokeKernel (cx=0x7fffdb85c000, args=..., 
    construct=js::NO_CONSTRUCT)
    at /home/bjacob/mozilla-central/js/src/jsinterp.cpp:499
#9  0x00007ffff5669c53 in js::Interpret (cx=0x7fffdb85c000, 
    entryFrame=0x7fffe1500030, interpMode=js::JSINTERP_NORMAL)
    at /home/bjacob/mozilla-central/js/src/jsinterp.cpp:2699
#10 0x00007ffff565d69f in js::RunScript (cx=0x7fffdb85c000, script=0x7fffe0a82f18, 
    fp=0x7fffe1500030) at /home/bjacob/mozilla-central/js/src/jsinterp.cpp:454
#11 0x00007ffff565e1e0 in js::ExecuteKernel (cx=0x7fffdb85c000, 
    script=0x7fffe0a82f18, scopeChain=..., thisv=..., type=js::EXECUTE_GLOBAL, 
    evalInFrame=0x0, result=0x0)
    at /home/bjacob/mozilla-central/js/src/jsinterp.cpp:657
#12 0x00007ffff565e41d in js::Execute (cx=0x7fffdb85c000, script=0x7fffe0a82f18, 
    scopeChainArg=..., rval=0x0)
    at /home/bjacob/mozilla-central/js/src/jsinterp.cpp:698
#13 0x00007ffff559c141 in EvaluateUCScriptForPrincipalsCommon (cx=0x7fffdb85c000, 
    obj=0x7fffe0a64060, principals=0x7fffd600d188, originPrincipals=0x0, 
    chars=0x7fffdfc02008, length=10730, 
    filename=0x7fffd600e188 "file:///home/bjacob/mozilla-central/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html", lineno=90, rval=0x0, 
    compileVersion=JSVERSION_DEFAULT)
    at /home/bjacob/mozilla-central/js/src/jsapi.cpp:5321
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) frame 3
#3  0x00007ffff412ea07 in nsCOMPtr<mozilla::WebGLExtension>::Assert_NoQueryNeeded (
    this=0x7fffdb8934a0) at ../../../dist/include/nsCOMPtr.h:532
532	              NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
(gdb) l
527	      Assert_NoQueryNeeded()
528	        {
529	          if ( mRawPtr )
530	            {
531	              nsCOMPtr<T> query_result( do_QueryInterface(mRawPtr) );
532	              NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
533	            }
534	        }
535	
536	  #define NSCAP_ASSERT_NO_QUERY_NEEDED() Assert_NoQueryNeeded();
(gdb) p mRawPtr
$1 = (mozilla::WebGLExtensionStandardDerivatives *) 0x7fffd300b220
(gdb) p query_result.get()
[Thread 0x7fffe3ec4700 (LWP 3057) exited]
$2 = (mozilla::WebGLExtension *) 0x0
Comment on attachment 603590 [details] [diff] [review]
use a nsRefPtr, not a nsCOMPtr, with WebGLExtension

Review of attachment 603590 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, assuming the semantics are the same for both types.
Attachment #603590 - Flags: review?(jgilbert) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/0ea11429b9ac

Yes, the semantics are the same in this case. nsCOMPtr just has some XPCOM specific stuff that we don't use in this case.
Assignee: nobody → bjacob
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla13
https://hg.mozilla.org/mozilla-central/rev/0ea11429b9ac
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.