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

ColorOverlay produces QQuickItem: Cannot use same item on different windows at the same time.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.5
    • None

    Description

      Moving an item containing a ColorOverlay, from window to another results in:

      QQuickItem: Cannot use same item on different windows at the same time.
      

      In more complex examples I can also see

      Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()
      
      ==89057==ERROR: AddressSanitizer: SEGV on unknown address 0x000075000111 (pc 0x7f00b62207e1 bp 0x7f00924008c0 sp 0x7f0092400890 T6)
      ==89057==The signal is caused by a READ memory access.
          #0 0x7f00b62207e1 in QSGOpenGLLayer::grab() scenegraph/qsgopengllayer.cpp:316
          #1 0x7f00b6220954 in QSGOpenGLLayer::updateTexture() scenegraph/qsgopengllayer.cpp:187
          #2 0x7f00b636dc05 in QQuickOpenGLShaderEffectMaterial::updateTextures() const items/qquickopenglshadereffectnode.cpp:474
          #3 0x7f00b61aef07 in QSGRenderer::preprocess() scenegraph/coreapi/qsgrenderer.cpp:337
          #4 0x7f00b61ae7c2 in QSGRenderer::renderScene(QSGBindable const&) scenegraph/coreapi/qsgrenderer.cpp:238
          #5 0x7f00b61aece6 in QSGRenderer::renderScene(unsigned int) scenegraph/coreapi/qsgrenderer.cpp:212
          #6 0x7f00b6218470 in QSGDefaultRenderContext::renderNextFrame(QSGRenderer*, unsigned int) scenegraph/qsgdefaultrendercontext.cpp:228
          #7 0x7f00b627bcf8 in QQuickWindowPrivate::renderSceneGraph(QSize const&, QSize const&) items/qquickwindow.cpp:617
          #8 0x7f00b62259ae in QSGRenderThread::syncAndRender(QImage*) scenegraph/qsgthreadedrenderloop.cpp:837
          #9 0x7f00b622985a in QSGRenderThread::run() scenegraph/qsgthreadedrenderloop.cpp:1043
          #10 0x7f00b40feb34 in QThreadPrivate::start(void*) thread/qthread_unix.cpp:329
          #11 0x7f00b316a258 in start_thread (/usr/lib/../lib/libpthread.so.0+0x9258)
          #12 0x7f00b32945e2 in __GI___clone (/usr/lib/libc.so.6+0xfe5e2)
      
      

      Example:

      import QtQuick 2.12
      import QtQuick.Window 2.15
      import QtGraphicalEffects 1.15
      
      Item {
      
          Window {
              id: window1
              visible: true
              Rectangle {
                  id: root1
                  color: "blue"
                  anchors.fill: parent
              }
          }
      
          Window {
              id: window2
              visible: true
              Rectangle {
                  id: root2
                  color: "red"
                  anchors.fill: parent
      
                  Rectangle {
                      id: itemToMove
                      anchors.fill: parent
      
                      MouseArea {
                          anchors.fill: parent
                          onClicked: {
                              console.log("Clicked");
                              if (itemToMove.parent == root2) {
                                  itemToMove.parent = root1;
                              } else {
                                  itemToMove.parent = root2;
                              }
                          }
      
                          Rectangle {
                              id: rectangle
                              width: 100
                              height: 100
                              anchors.verticalCenter: parent.verticalCenter
                              ColorOverlay {
                                  visible: true
                                  anchors.fill: rectangle
                                  source: rectangle
                                  color: "#FFFFFF"
                              }
                          }
      
                          Text {
                              text: "click me"
                              anchors.fill: parent
                          }
                      }
                  }
              }
          }
      }
      
      

      Attachments

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

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            iamsergio Sergio Martins
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes