Search code examples
windowsqt64-bitqtscript

QtScript: crash on 64-bit windows


I have compiled Qt for 64-bit architecture under windows and all works fine except QtScript. The following simple code, working perfectly with 32-bit Qt for Windows, crashes if compiled with 64-bit Qt. Maybe it's an error in my code? Or Qt is not compatible with 64-bit? Or something else? Any comments are welcome.

#include <QtCore/QCoreApplication>
#include <QScriptEngine>
int main(int argc, char *argv[])
{
  QCoreApplication app( argc, argv);
  QScriptEngine oEngine;
  oEngine.evaluate( "function foo(){var a=[[0]]; a[0][0];}" );
  for(;;)
  {
    oEngine.evaluate( "foo" ).call();
  }
}

Solution

  • The crash is occurring inside JavaScriptCore, which is a 3rd party component from the WebKit project (http://webkit.org/projects/javascript/index.html):

    Visual Studio reports that the crash is occurring on line 641 of c:\Qt\4.6.1\src\3rdparty\javascriptcore\JavaScriptCore\runtime\JSObject.h and is stopped on the call to JSCell::getOwnPropertySlot (JSCell.cpp:126). The stack trace is:

    QtScriptd4.dll!QTJSC::JSValue::get
    QtScriptd4.dll!QTJSC::JSValue::get
    QtScriptd4.dll!QTJSC::Interpreter::privateExecute
    QtScriptd4.dll!QTJSC::Interpreter::execute
    QtScriptd4.dll!QTJSC::JSFunction::call
    QtScriptd4.dll!QTJSC::call
    QtScriptd4.dll!QScriptValue::call
    test.exe!main

    There are lots of warnings about possible 64-bit issues when building the WebKit component on Windows using the Visual C++ compiler so I suspect it's not a configuration that is supported or has been debugged yet.

    I've updated the QT bug report QTBUG-7344.