[Qt-interest] QtScript object deletion and popContext

Dave Ceddia dceddia at gmail.com
Fri Nov 20 16:49:46 CET 2009


I've got a program that's running scripts inside a separate context. The
idea is that the user can load a script from disk, run it, and then load
another and run it, and they'll have their own contexts. Something like:

engine->pushContext();
engine->evaluate( scriptCode );
engine->popContext();

I've noticed that if I create objects inside scriptCode, they will still
exist once the script stops running and the old context is popped. I have a
few QObject-wrapped classes with associated script constructor functions,
and the C++ object's destructor never gets called until I close the entire
application.

Is this a bug? Or maybe I'm missing something that deallocates unused
objects? It seems like variables inside a context should be deallocated when
popContext() is called, since they wouldn't be accessible any more.

Thanks,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091120/99ded196/attachment.html 


More information about the Qt-interest-old mailing list