Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Blocking behavior Quick qt 5.2.1: random crash on Image elements when caching is false
Forum Updated to NodeBB v4.3 + New Features

Blocking behavior Quick qt 5.2.1: random crash on Image elements when caching is false

Scheduled Pinned Locked Moved QML and Qt Quick
10 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    asergiu
    wrote on last edited by
    #1

    We have an I3 machine on Linux with the following specs:
    0:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
    00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
    Opengl 1.4
    Regular PC - nothing spectacular.

    Whenever Image caching is false the bellow code crashes randomly when the image sources are changed (as bellow). I did not attach the images but you can use your ow - mines are 800x600 for Images and 80x60 those on the btns. This code does not crash on my laptop apparently on the same version of linux (opensuse) . The hardware difference is Nvidia grahics on laptop and CPU integrated graphic card on I3.

    I know - some will tell that it does not Segfault. On my laptop with Nvidia graphic card does not either while on the integrated CPU graphics card segfaults after a couple of changes
    @
    Rectangle {
    width: 1024
    height: 768

    Row {
        property int imgWidth: 300
        property int imgHeight: 300
    
        Image {
            id: img1
            cache: false
            width: parent.imgWidth
            height: parent.imgHeight
            source: "BallGolf.png"
        }
    
        Image {
            id: img2
            cache: false
            width: parent.imgWidth
            height: parent.imgHeight
            source: "Fish.png"
        }
    }
    
    Column {
        property int imgWidth: 100
        property int imgHeight: 100
        anchors.right: parent.right
    
        Image {
            id: btn1
            source: "LensBrownOn.png"
            width: parent.imgWidth
            height: parent.imgHeight
            cache: false
    
            MouseArea {
                anchors.fill: parent
    
                onClicked: {
                    img1.source = "Fish.png"
                    img2.source = "BallGolf.png"
    
                    btn1.source = "LensBrownOnDark.png"
                    btn2.source = "LensBrownOn.png"
                }
            }
        }
    
        Image {
            id: btn2
            source: "LensBrownOnDark.png"
            width: parent.imgWidth
            height: parent.imgHeight
            cache: false
    
            MouseArea {
                anchors.fill: parent
    
                onClicked: {
                    img1.source = "BallGolf.png"
                    img2.source = "Fish.png"
    
                    btn1.source = "LensBrownOn.png"
                    btn2.source = "LensBrownOnDark.png"
                }
            }
        }
    }
    

    }@

    1 Reply Last reply
    0
    • T Offline
      T Offline
      topix93
      wrote on last edited by
      #2

      i think that i have your same issue. my program start crashing randomly after i use cache: false... this is th backtrace of the crash:

      @~"#0 0xb7d41191 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#1 0xb7d403a4 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#2 0xb7d3fd77 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#3 0xb7d3fd77 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#4 0xb7d3fd77 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#5 0xb7d3fd77 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#6 0xb7d3fd77 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#7 0xb7d3fd77 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#8 0xb7d3fd77 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#9 0xb7d40ded in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#10 0xb7d24715 in QSGRenderer::preprocess() () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#11 0xb7d0ccd4 in QSGBatchRenderer::Renderer::preprocess() () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#12 0xb7d2435f in QSGRenderer::renderScene(QSGBindable const&) () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#13 0xb7d243bd in QSGRenderer::renderScene() () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#14 0xb7d35308 in QSGRenderContext::renderNextFrame(QSGRenderer*, unsigned int) () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#15 0xb7d77510 in QQuickWindowPrivate::renderSceneGraph(QSize const&) () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#16 0xb7d54419 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#17 0xb7d54d25 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Quick.so.5\n"
      ~"#18 0xb6d27fd9 in ?? () from /home/User/Qt5.2.1/5.2.1/gcc/lib/libQt5Core.so.5\n"
      ~"#19 0xb6c38d4c in start_thread (arg=0xaafc3b40) at pthread_create.c:308\n"
      ~"#20 0xb6a74bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130\n"@

      Have you made any progress ?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        asergiu
        wrote on last edited by
        #3

        Unfortunately the only solution we found is to switch back to QT 5.1.1 . We had so many random crashes on the Intel graphics card that it was unbearable even to look for them at some point.
        We started to look for a solution and we fixed it in some points by changing the order the images are switched but THIS is NOT a FIX so we abandoned when the issue manifested somewhere else in the code (Image element with cache false).

        The quick fix was to change the order of source changing in OnMousePressed. Yes I know it is inexplicable - but it fixed it in some cases. I believe there is a race condition somewhere in the new renderer in QT 5.2.1 threads. I don't know how to pinpoint it however.

        It almost NEVER happens on Nvidia or other cards - or we did not test it enough cause we only have them on some development machines, but on Intel CPU I3 integrated card the crash happens after 2-3 clicks in the app.

        IMPORTANT Notice: This problem seems to menifest only on LInux platforms. We do develop the same thing on Windows and it doesn't crash there - but again we don't use the same Intel CPU integrated graphic cards. I will test it and come back. We do sincerely hope that this is fixed in the Qt 5.3 as 5.2.1 was a major showstopper for us. It has a large performance improvement on graphics rendering - but at this cost is not an advantage.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          asergiu
          wrote on last edited by
          #4

          New info:
          I need cache: false because sometimes I need to load a new picture in the Image element.

          If cache:true even if you change the content of the image file on disk the image is preloaded in the QT Quick cache and is not refreshed. The same happens if I use ImageProviders - the image is not reloaded with the new content.

          If cache:false in QT 5.1.1 it does change the content of the image with the new picture in both cases (image loaded from disk or from image provider) while in QT 5.2.1 it randomly crashes the application (see in the code above).

          Expected behavior: load the new content of the image and display it without segfaulting !

          1 Reply Last reply
          0
          • T Offline
            T Offline
            topix93
            wrote on last edited by
            #5

            i try to use qt 5.1.1.. if i set cache: false it works for me, the image loads the new content correctly

            1 Reply Last reply
            0
            • A Offline
              A Offline
              asergiu
              wrote on last edited by
              #6

              Yes - this is what I was saying.

              In QT 5.1.1 it works as expected !
              It crashes randomly in QT 5.2.1 with a CPU Integrated graphics. I believe is because of the new renderer in QT 5.2.1

              1 Reply Last reply
              0
              • T Offline
                T Offline
                topix93
                wrote on last edited by
                #7

                i'm sorry i read it wrong

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  topix93
                  wrote on last edited by
                  #8

                  i get the same crash also in QT 5.1.1 this is my backtrace
                  @>~"#0 0xb7d61621 in ?? () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"

                  ~"#1 0xb7d60354 in ?? () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#2 0xb7d4ab42 in QSGRenderer::preprocess() () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#3 0xb7d4a631 in QSGRenderer::renderScene(QSGBindable const&) () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#4 0xb7d4a81d in QSGRenderer::renderScene() () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#5 0xb7d561be in QSGContext::renderNextFrame(QSGRenderer*, unsigned int) () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#6 0xb7d953e2 in QQuickWindowPrivate::renderSceneGraph(QSize const&) () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#7 0xb7d73e96 in ?? () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#8 0xb7d7467f in ?? () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Quick.so.5\n"
                  ~"#9 0xb6f3e3a9 in ?? () from /home/bertero/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5\n"
                  ~"#10 0xb6e56d4c in start_thread (arg=0xab72db40) at pthread_create.c:308\n"
                  ~"#11 0xb6c92bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130\n"@

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    asergiu
                    wrote on last edited by
                    #9

                    pincopallapino - could you post your qml code - or a sample here ?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      asergiu
                      wrote on last edited by
                      #10

                      Seems that the issues are fixed in qt 5.3 alpha/beta

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved