Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7433

QtScript crash if Qt is compiled as 64-bit on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.0
    • Qt Script
    • None
    • Windows 7 professional 64-bit, Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1

    Description

      Following code works perfectly if compiled with Qt 4.6.0 32-bit from QT window installer.
      If Qt is compiled as 64-bit using Microsoft Windows SDK (http://tinyurl.com/yjmzhno) code crashes. I have checked both with 4.6.0 sources from www.qtsoftware.com and latest Git snapshot. Code is console Qt application, crashes both in debug and release with access violation:

      main.h

      #pragma once

      #include <QObject>
      #include <QScriptEngine>

      class Script : public QObject
      {
      Q_OBJECT;
      public slots: void Test();
      private: QScriptEngine m_oEngine;
      };

      class App : public QObject
      {
      Q_OBJECT;
      signals: void ScriptTest();
      protected: void timerEvent( QTimerEvent* );
      };

      main.cpp

      #include <QtCore/QCoreApplication>
      #include <QThread>
      #include "main.h"

      void Script::Test()
      {
      QString sScript = "function OnStart() { var a = [ [ 0 ] ]; "
      "for( var i = 0; i < 3; i ++ ) { for( var j = 0; j < 100; j ++ ) "
      "

      { \"a\" + a[ 0 ][ 0 ]; }

      } }";
      m_oEngine.evaluate( sScript );
      QScriptValue oFnStart = m_oEngine.evaluate( "OnStart" );
      oFnStart.call();
      }

      void App::timerEvent( QTimerEvent* )

      { ScriptTest(); }

      int main(int argc, char *argv[])
      {
      QCoreApplication a(argc, argv);
      QThread scriptThread;
      scriptThread.start();
      Script script;
      script.moveToThread( & scriptThread );
      App app;
      script.connect( & app, SIGNAL( ScriptTest() ), SLOT( Test() ) );
      app.startTimer( 50 );
      return a.exec();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kenthans Kent Hansen (Inactive)
            eyeofhell Grigory Petrov
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes