Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTreeWidget causes the app to crash after deleting the last QTreeWidgetItem
Forum Updated to NodeBB v4.3 + New Features

QTreeWidget causes the app to crash after deleting the last QTreeWidgetItem

Scheduled Pinned Locked Moved Solved General and Desktop
22 Posts 3 Posters 2.1k Views
  • 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 Andrea_Venturelli

    yes @jsulm, is GDB as illustrated in the code snippet some messages ago

    this is taken from the "Global Debugger Log" panel , after running the Debug play button
    and is clearly referring to GDB

    • GDB PROCESS FINISHED, status 0, exit code 1 (0x1)
    • d[GDB] NOTE: ENGINE SETUP FAILED
    d[GDB] UNEXPECTED GDB STDERR: error: unknown option: --tty=\\.\pipe\creator-11944-28798
    derror: unknown option: -i
    dUse 'lldb.exe --help' for a complete list of options.
    d[GDB] GDB PROCESS FINISHED, status 0, exit code 1 (0x1)
    d[GDB] NOTE: ENGINE SETUP FAILED
    d[GDB] State changed from EngineSetupRequested(1) to EngineSetupFailed(2)
    <Debugging has failed.
    d[GDB] State changed from EngineSetupFailed(2) to DebuggerFinished(16)
    
    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #11

    @Andrea_Venturelli said in QTreeWidget causes the app to crash after deleting the last QTreeWidgetItem:

    dUse 'lldb.exe --help' for a complete list of options.

    Why don't you simply check in the Kit which debugger is set?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Andrea_Venturelli
      wrote on last edited by
      #12

      how can i do that? it's not clear to me, where the informations of the debug type resides; a screenshot could be helpfull or even the path like so:

      [Qt creator] >> Edit >> Preferences... >> Debugger .. and so on or
      [Qt Maintenance Tool] >> Extencion >> ecc..

      because I have a little experience with Qt Creator, resulting in me, not knowing where to look for

      jsulmJ 1 Reply Last reply
      0
      • A Andrea_Venturelli

        how can i do that? it's not clear to me, where the informations of the debug type resides; a screenshot could be helpfull or even the path like so:

        [Qt creator] >> Edit >> Preferences... >> Debugger .. and so on or
        [Qt Maintenance Tool] >> Extencion >> ecc..

        because I have a little experience with Qt Creator, resulting in me, not knowing where to look for

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #13

        @Andrea_Venturelli [Qt creator] >> Edit >> Preferences... >> Kits - then select the Kit you're using

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Andrea_Venturelli
          wrote on last edited by
          #14

          this is what I use to create the projects (and using qMake to built):

          2afcf80d-aff5-4617-b083-7595a9fc08d9-image.png

          fca12174-061d-4777-b7bb-e4587d46b207-image.png

          jsulmJ 1 Reply Last reply
          0
          • A Andrea_Venturelli

            this is what I use to create the projects (and using qMake to built):

            2afcf80d-aff5-4617-b083-7595a9fc08d9-image.png

            fca12174-061d-4777-b7bb-e4587d46b207-image.png

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #15

            @Andrea_Venturelli Please show ALL settings of that Kit (especially Qt version and debugger set).

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Andrea_Venturelli
              wrote on last edited by
              #16

              Desktop Qt 6.7.1 llvm-mingw 64-bit

              c++ compiler:

              LLVM-MinGW 17.0.6 64-bit for c++

              Debugger:

              LLVM lldb 17.0.6 64-bit

              Qt version:

              Qt 6.7.1 llvm-mingw 64-bit

              CMake Tool:

              CMake 3.27.7 (Qt)

              4e8e562b-d582-404d-8525-9e23544ff8aa-image.png

              jsulmJ 1 Reply Last reply
              0
              • A Andrea_Venturelli

                Desktop Qt 6.7.1 llvm-mingw 64-bit

                c++ compiler:

                LLVM-MinGW 17.0.6 64-bit for c++

                Debugger:

                LLVM lldb 17.0.6 64-bit

                Qt version:

                Qt 6.7.1 llvm-mingw 64-bit

                CMake Tool:

                CMake 3.27.7 (Qt)

                4e8e562b-d582-404d-8525-9e23544ff8aa-image.png

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #17

                @Andrea_Venturelli Try with Qt for MinGW (not llvm-mingw).
                Maybe QtCreator does not support lldb properly.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • cristian-adamC Offline
                  cristian-adamC Offline
                  cristian-adam
                  wrote on last edited by cristian-adam
                  #18

                  It looks like the LLVM MInGW debugger has the wrong debugger type set. It should be LLDB and not GDB.

                  https://bugreports.qt.io/browse/QTBUG-123330 was supposed to be a thing of the past...

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Andrea_Venturelli
                    wrote on last edited by
                    #19

                    How should I change the current project KIT, transitioning from llvm-mingw to MinGW ??

                    I tryed it, from the preferences panel under: Edit >> Preferences... >> Kits
                    but I'm pretty sure that has no impact on the current project, instead will change the default Kit, the next time I'll create a new project.

                    Exists such a way to change the Kit to the current running project or I'm forced to create a brand-new one and manually paste the code?

                    jsulmJ 1 Reply Last reply
                    0
                    • A Andrea_Venturelli

                      How should I change the current project KIT, transitioning from llvm-mingw to MinGW ??

                      I tryed it, from the preferences panel under: Edit >> Preferences... >> Kits
                      but I'm pretty sure that has no impact on the current project, instead will change the default Kit, the next time I'll create a new project.

                      Exists such a way to change the Kit to the current running project or I'm forced to create a brand-new one and manually paste the code?

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #20

                      @Andrea_Venturelli said in QTreeWidget causes the app to crash after deleting the last QTreeWidgetItem:

                      How should I change the current project KIT, transitioning from llvm-mingw to MinGW ??

                      On the right side in QtCreator "Projects".
                      From your screen-shots it looks like you already have a Kit for Qt MinGW.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        Andrea_Venturelli
                        wrote on last edited by
                        #21

                        okay, finally we did it!
                        for the other reader who might encounter this problem with the debugger, the solution is:

                        1. on the left panel (where it is "Welcome", "Edit", "Design") there is "Projects"
                        2. open projects and under "Built & Run" you have all the kit available
                        3. I switched from Desktop Qt 6.7.1 llvm-mingw 64-bit to Desktop Qt 6.7.1 MinGW 64-bit
                        4. I pressed the "run" button and compile fine.
                        5. after I Run the normal "Debug play button" at the bottom left cornern and now is working

                        009e87f9-5bf1-4471-b513-4f63b7bd230a-image.png

                        now we can go back to the main issues where this discussion started

                        1 Reply Last reply
                        1
                        • A Offline
                          A Offline
                          Andrea_Venturelli
                          wrote on last edited by
                          #22

                          this is the error I get after deleting the last item in the QTreeWidget:

                          790d0649-97c5-47ae-81db-d4585de35e97-image.png

                          here the call stack:
                          fd4c28d6-fa62-47b4-b237-68a08deab34d-image.png

                          I also found out where was the problem, other then I'm a big chicken ;)

                          SOLUTION

                          I had the QTreeWidget::ItemChanged signal, connected to one of my custom slots where i automatically update the values inside the LineEdits. But I ignored that, even when the last item is deleted, the QTreeWidget calls the "ItemChanged" signal.

                          adding a check if the, before trying to retrive information from an empty QTreeWidgetItem solved the problem

                          void Dialog::on_treeWidgetItemChanged()
                          {
                              // check control
                              if (m_paths.count())
                              {
                                  auto current_itm = ui->left_wdg->currentItem();
                          
                                  // update the lineEdit' values
                                  ui->fn_le->setText(current_itm->text(0));           // THIS WAS THE CAUSE OF THE ERROR
                                  ui->fPath_le->setText(current_itm->text(1));
                              }
                          }
                          
                          1 Reply Last reply
                          1
                          • A Andrea_Venturelli has marked this topic as solved on

                          • Login

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