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

Unloading a Canvas with renderTarget of Canvas.Image causes crash

    XMLWordPrintable

Details

    • 23b59c127a320f6d7851bc05d17d08cfecbd2879 9ad9615d0003c9fb84255152f0cbb473ee2a7a70

    Description

      With the following code, press Return to set the loader source and Space to unload it.

      import QtQuick 2.0
      
      Item {
          width: 500; height: 500
      
          Loader { id: loader }
      
          focus: true
          Keys.onReturnPressed: loader.source = "simple.qml"
          Keys.onSpacePressed: loader.source = ""
      }
      

      Simple.qml:

      import QtQuick 2.0
      
      
      Canvas {
          id: canvas
          width: 200; height: 200
      
         renderTarget: Canvas.Image         // if this is removed, it does not crash
      
          onPaint: {
              var context = canvas.getContext('2d')
              context.fillRect(50, 50, 100, 100)
          }
      
      }
      

      When "simple.qml" is unloaded, qmlscene crashes:

      Program received signal EXC_BAD_ACCESS, Could not access memory.
      Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
      0x00007fff865c16e3 in glDeleteTextures ()
      (gdb) bt
      #0  0x00007fff865c16e3 in glDeleteTextures ()
      #1  0x00000001009a736b in QSGPlainTexture::~QSGPlainTexture (this=0x1059c1e10) at qsgtexture.cpp:404
      #2  0x00000001027612da in qDeleteInEventHandler (o=0x1059c1e10) at qobject.cpp:4029
      #3  0x000000010276cf49 in QObject::event (this=0x1059c1e10, e=0x1059c2090) at qobject.cpp:1098
      #4  0x00000001043a1bfa in QApplicationPrivate::notify_helper (this=0x105921b70, receiver=0x1059c1e10, e=0x1059c2090) at qapplication.cpp:4193
      #5  0x00000001043a21dd in QApplication::notify (this=0x7fff5fbff5b8, receiver=0x1059c1e10, e=0x1059c2090) at qapplication.cpp:3610
      #6  0x000000010273e871 in QCoreApplication::notifyInternal (this=0x7fff5fbff5b8, receiver=0x1059c1e10, event=0x1059c2090) at qcoreapplication.cpp:826
      #7  0x000000010014e0a9 in QCoreApplication::sendEvent (receiver=0x1059c1e10, event=0x1059c2090) at qcoreapplication.h:207
      #8  0x000000010273f08f in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x10591f410) at qcoreapplication.cpp:1468
      #9  0x000000010273f375 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at qcoreapplication.cpp:1338
      #10 0x0000000102d671ef in QCoreApplication::sendPostedEvents () at qcoreapplication.h:212
      #11 0x0000000102d66922 in QWindowSystemInterface::sendWindowSystemEvents (eventDispatcher=0x105921db0, flags=@0x7fff5fbfdb10) at qwindowsysteminterface_qpa.cpp:296
      #12 0x0000000107f9b42a in processPostedEvents (d=0x106058a00, blockSendPostedEvents=false) at qcocoaeventdispatcher.mm:985
      #13 0x0000000107f9a91e in QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback (info=0x106058a00) at qcocoaeventdispatcher.mm:1020
      #14 0x00007fff892ca241 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
      #15 0x00007fff892c9aad in __CFRunLoopDoSources0 ()
      #16 0x00007fff892f08d9 in __CFRunLoopRun ()
      #17 0x00007fff892f0216 in CFRunLoopRunSpecific ()
      #18 0x00007fff8a7d34ff in RunCurrentEventLoopInMode ()
      #19 0x00007fff8a7dac21 in ReceiveNextEventCommon ()
      #20 0x00007fff8a7daaae in BlockUntilNextEventMatchingListInMode ()
      #21 0x00007fff81d4f191 in _DPSNextEvent ()
      #22 0x00007fff81d4ea95 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
      #23 0x00007fff81d4b3d6 in -[NSApplication run] ()
      #24 0x0000000107f9bec8 in QCocoaEventDispatcher::processEvents (this=0x105921db0, flags=@0x7fff5fbff2d8) at qcocoaeventdispatcher.mm:577
      #25 0x0000000102738935 in QEventLoop::processEvents (this=0x7fff5fbff400, flags=@0x7fff5fbff360) at qeventloop.cpp:149
      #26 0x0000000102738dd0 in QEventLoop::exec (this=0x7fff5fbff400, flags=@0x7fff5fbff428) at qeventloop.cpp:225
      #27 0x000000010273f51a in QCoreApplication::exec () at qcoreapplication.cpp:1093
      #28 0x0000000102d7dba3 in QGuiApplication::exec () at qguiapplication.cpp:481
      #29 0x00000001043a6232 in QApplication::exec () at qapplication.cpp:3494
      #30 0x000000010000a4a1 in main (argc=2, argv=0x7fff5fbffb40) at main.cpp:533
      

      Attachments

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

        Activity

          People

            sletta Gunnar Sletta
            bealam Bea Lam (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes