<div>Hi,</div>
<div> </div>
<div>I'm working on an issue related to NPAPI plugin on QT port of webkit on Symbian platform.</div>
<div> </div>
<div>Basically our plug-in handles Async requests from JavaScript and does some processing and returns the response in the JavaScript callback asynchronously.</div>
<div> </div>
<div>In the JS callback, we are passing an NPObject instance and to do this we are using NPN_InvokeDefault(). This NPObject has been created in my plug-in </div>
<div>with NPClass *_class in the NPObject, pointing to a static global instance of NPClass filled with my function pointers(for allocate, deallocate,etc) . </div>
<div> </div>
<div>Once NPN_InvokeDefault() is called, webkit is calling NPN_RetainObject() on this NPObject (while creating CInstance) increasing the ref count.</div>
<div> </div>
<div>Now in the JavaScript callback , I'm calling window.location.reload() which will unload all the NP Plugins. In this process all the global static data allocated by the plugin is invalidated (Hence our NPClass * is also invalid after this) and in the destruction sequence I'm calling NPN_ReleaseObject on the NPObject I had allocated and passed to webkit. But webkit still has reference to this NPObject even after unloading the plug-in. And later when the JavaScript Garbage collection is triggered, it is trying to call NPN_ReleaseObject() on my NPObject resulting in a crash. <br clear="all">
</div>
<div>Is there anything wrong with my understanding of NPAPI memory management? If not, then would it be right for the webkit to trigger the Garbage collection forcefully before unloading the plug-in to prevent this crash?. <br>
</div>
<div>Regards,<br>Chandan <br></div>