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

Crash after instantiating Q_GADGET ctor in QJSEngine

    XMLWordPrintable

Details

    • 23cca59848087875ae3486f61d1cd4fe0d90fe7c

    Description

      When instantiating a Q_GADGET using a constructor in some Javascript using QJSEngine, there is a segfault in libQt5Qml.

      Attached sample program causing crash, backtrace and valgrind output.  You can see in the backtrace output that both class constructors are successfully called, but that the program crashes after the call to the Gadget ctor.

      backtrace
      piggz@linux-f1uu ~/projects/build-gadget_crash-Desktop_Qt_5_8_0_GCC_64bit-Debug $ gdb ./gadget_crash 
      GNU gdb (GDB; openSUSE Tumbleweed) 8.0
      Copyright (C) 2017 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
      and "show warranty" for details.
      This GDB was configured as "x86_64-suse-linux".
      Type "show configuration" for configuration details.
      For bug reporting instructions, please see:
      <http://bugs.opensuse.org/>.
      Find the GDB manual and other documentation resources online at:
      <http://www.gnu.org/software/gdb/documentation/>.
      For help, type "help".
      Type "apropos word" to search for commands related to "word"...
      Reading symbols from ./gadget_crash...done.
      (gdb) r
      Starting program: /home/piggz/projects/build-gadget_crash-Desktop_Qt_5_8_0_GCC_64bit-Debug/gadget_crash 
      <snip missing symbols>
      Created object
      Created gadget
      
      Program received signal SIGSEGV, Segmentation fault.
      0x00007ffff72518ad in ?? () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      (gdb) bt
      #0  0x00007ffff72518ad in ?? () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      #1  0x00007ffff7252741 in ?? () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      #2  0x00007ffff72531ef in ?? () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      #3  0x00007ffff72533da in QV4::QMetaObjectWrapper::callConstructor(QQmlPropertyData const&, QV4::ExecutionEngine*, QV4::CallData*) const () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      #4  0x00007ffff7253c12 in QV4::QMetaObjectWrapper::constructInternal(QV4::CallData*) const () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      #5  0x00007ffff7253c7c in QV4::QMetaObjectWrapper::construct(QV4::Managed const*, QV4::Scope&, QV4::CallData*) () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      #6  0x00007ffff726a44c in QV4::Runtime::method_constructActivationProperty(QV4::ExecutionEngine*, int, QV4::CallData*) () from /home/piggz/sdks/Qt5.8.0/5.8/gcc_64/lib/libQt5Qml.so.5
      #7  0x00007ffff7e0609c in ?? ()
      #8  0x0000000000000000 in ?? ()
      

      Attachments

        1. backtrace
          2 kB
        2. main.cpp
          1 kB
        3. valgrind
          10 kB
        For Gerrit Dashboard: QTBUG-62007
        # Subject Branch Project Status CR V

        Activity

          People

            yulong.bai Bai Yulong
            piggz Adam Pigg
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes