[Qt-interest] C++ exceptions crashing QtScript

Mike Filonov mikefilonov at gmail.com
Wed Feb 4 14:10:35 CET 2009


Hi,
I am adding script support to my Qt application.
I use my QObjects inside the scripts to provide scripting API. This
objects can throw exeptions.

I'm catching the exceptions with try-catch block around
engine->evaluate() call like this:
try
{
   QScriptValue result = this->engine->evaluate( code );
}
catch( ... )
{
}

Normaly this works fine, but sometimes it just crashes
So i will try to describe the situation.

In my class i have the function "funct" that can throw exeptions.
After evalution of this script:

v = myObject.funct();

i get that exception in the catch block.

If after that i am trying to evalutate script that uses this variable
(for example: v.Name) than instead of throwing  the script exception
"ReferenceError: v is not defined" my application crashes during the
engine->evaluate call because of memory read error (that cannot be
handled)

Is it a bug of QtScript and is there some workarounds?

thank you



More information about the Qt-interest-old mailing list