开发者

when to use NPN_ReleaseVariantValue in plugin?

When to use ReleaseVariantValue() is not clear to me, I already read

https://开发者_开发问答developer.mozilla.org/en/NPN_ReleaseVariantValue

http://dev.opera.com/articles/view/the-opera-plug-in-interface/#NPN_ReleaseVariantValue

Can you please tell me in which usecase shall we use it?


You can uses this to flush the value held for any variant - string, object etc. The browser internally clears the value based on the object type. This may also mean deallocating memory

As per MDC,

"This must always be called on result variants and such in this API, i.e. any NPVariant whose value comes from a call that passes back an NPVariant must be released using this function. "

So, if you use some calls that put the result in an (NPVariant *) like NPN_Invoke() or NPN_GetProperty(), you should use NPN_ReleaseVariantValue() to clear them

See also: http://colonelpanic.net/2009/12/memory-management-in-npapi/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜