O/H Boris Zbarsky έγραψε:
On 11/3/09 1:56 PM, Georgios Petasis wrote:
Unless its callers are very careful, DOM::GetBody leaks the body.
The caller calls AddRef/Release:

set body [$dom GetBody]
set encoder [$dom GetEncoder text/plain 0]
$body AddRef
$encoder AddRef
$encoder SetNode $body
set content [$encoder EncodeToString]
$encoder SetNode NULL
$body Release
$encoder Release

From GetBody:

81 nsIDOMHTMLElement *ptr = NULL;
82 if (document) document->GetBody(&ptr);
83 return ptr;

The GetBody call calls addref on the body. If the above shows all the remaining addrefs and releases (that is, if your C++-to-tcl glue doesn't have an extra release on the return value of GetBody somewhere), then you just leaked the body.

Hm, exactly the same case as nsINavigation::GetDocument I suppose...

George
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to