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

QScriptEngine::evaluate ASSERT crash and possible memory leak.

    XMLWordPrintable

Details

    Description

      Crash happens in debug mode if QScriptEngine::evaluate(program(script)) is called. But works fine if calling with the same script other evaluate function QScriptEngine::evaluate(script).

      Crash happens in ASSERT located here:

      .\src\3rdparty\javascriptcore\JavaScriptCore\runtime\Executable.cpp
      JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNode)
      {
      ...
          ASSERT(!m_evalCodeBlock);
      ...
      }
      

      Looks like Executable instance is re-used when running program and m_evalCodeBlock not cleaned causing crash. So in release mode new m_evalCodeBlock is just allocated and possibly leaks memory. When running plain script Executable is re-created.

      Easy to reproduce with the attached example in debug mode.

      1. Enter a number > 0 in the first spin box.
      2. Hit Calc
      3. -> program counts up
      => no crash

      Do the same with checkbox "Use Program" enabled => ASSERT at first recursion.

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes