I am building an activex dll with Qt. I subclass QAxFactory to create the exported class object and use singleton pattern.
//MyFactory is subclass of QAxFactory
//MyClass is the exported class for com container to use
QObject *MyFactory::createObject(const QString &key)
{
return MyClass::getInstance();
}
Here is the problem:
After refresh the IE page several times, then close the IE page/window, the exported class MyClass's deconstruction gets called immediately, but MyFactory's deconstruction not. And in windows task manager, the iexplorer process does not quit. After about 30~50 seconds, the iexplorer process quit and MyFactory's deconstruction gets called.
I guess this is because my code did not clear some resources correctly, but I could not found what resource.
Is there a way I can debug this problem? Thanks in advance!
update 1
It looks like event handler did not get released properly in JS. Following is the event handler functions in js.
function MyClassObj::eventHandler()
{
console.log("event fired");
}
How do I release the handler properly when page get refreshed or closed?
update 2
After struggling for days, I got some updates: If I distribute this activex control as in-process(dll), IE process will wait for about 1 minute to quit after close. But if I use it as out-process(exe), IE will quit immediately after close.
I tried with Qt offical examples, it is the same.
Still not sure whether this is normal or not.