mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Fixed memory leak caused by HtmlCanvasElement not being released. (#1786)
* Fixed memory leak caused by HtmlCanvasElement not being released. * modify unroot * add comment
This commit is contained in:
@@ -444,6 +444,12 @@ static bool js_CanvasRenderingContext2D_setCanvasBufferUpdatedCallback(se::State
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
}
|
||||
};
|
||||
// Add an unroot to avoid the root of the copy constructor caused by the internal reference of Lambda.
|
||||
if (jsThis.isObject())
|
||||
{
|
||||
jsThis.toObject()->unroot();
|
||||
}
|
||||
jsFunc.toObject()->unroot();
|
||||
arg0 = lambda;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user