QTreeWidget causes the app to crash after deleting the last QTreeWidgetItem
-
I have an Hint; seems that, after removing successfully once of the three item, the QTreeWidget automatically select the previous index (if it is the first item, select the index after). When the last only remaining item is deleted i think the QTreeWidget is trying to set the previous index, but no indexex are available causing the program to crush
-
@Andrea_Venturelli said in QTreeWidget causes the app to crash after deleting the last QTreeWidgetItem:
What are the steps that i need to do, in order to collect the information you need ?
Click at the button in the bottom right corner with a bug on it in Qtcreator.
When the app crashes you will have the stack trace at the bottom. -
@jsulm okay, when i compile and run the application normaly, the application starts and I can test it without problems.
Instead, trying to run it in the Debug Mode (the button in the bottom-corner) nothing appen and no window appear..Here some screenshots:
1show version 2show debug-file-directory 3set max-completions 1000 4complete set arch 5set breakpoint pending on 6set print elements 10000 7set index-cache on 8set unwindonsignal on 9set width 0 10set height 0 Setting up inferior... 11set substitute-path /Users/qt/work/qt C:/Qt/6.7.1/Src 12set substitute-path C:/work/build/qt5_workdir/w/s C:/Qt/6.7.1/Src 13set substitute-path Q:/qt5_workdir/w/s C:/Qt/6.7.1/Src 14set substitute-path c:/Users/qt/work/install C:/Qt/6.7.1/Src 15set substitute-path c:/users/qt/work/qt C:/Qt/6.7.1/Src # directory does not exist: /usr/src/debug/qt5base/src/corelib # directory does not exist: /usr/src/debug/qt5base/src/gui # directory does not exist: /usr/src/debug/qt5base/src/network 16python sys.path.insert(1, 'C:/Qt/Tools/QtCreator/share/qtcreator/debugger') 17python from gdbbridge import * 18python theDumper.loadDumpers({"token":18}) Debugging has failed. 19show version 20show debug-file-directory 21set max-completions 1000 22complete set arch 23set breakpoint pending on 24set print elements 10000 25set index-cache on 26set unwindonsignal on 27set width 0 28set height 0 Setting up inferior... 29set substitute-path /Users/qt/work/qt C:/Qt/6.7.1/Src 30set substitute-path C:/work/build/qt5_workdir/w/s C:/Qt/6.7.1/Src 31set substitute-path Q:/qt5_workdir/w/s C:/Qt/6.7.1/Src 32set substitute-path c:/Users/qt/work/install C:/Qt/6.7.1/Src 33set substitute-path c:/users/qt/work/qt C:/Qt/6.7.1/Src # directory does not exist: /usr/src/debug/qt5base/src/corelib # directory does not exist: /usr/src/debug/qt5base/src/gui # directory does not exist: /usr/src/debug/qt5base/src/network 34python sys.path.insert(1, 'C:/Qt/Tools/QtCreator/share/qtcreator/debugger') 35python from gdbbridge import * 36python theDumper.loadDumpers({"token":36}) Debugging has failed. 37show version 38show debug-file-directory 39set max-completions 1000 40complete set arch 41set breakpoint pending on 42set print elements 10000 43set index-cache on 44set unwindonsignal on 45set width 0 46set height 0 Setting up inferior... 47set substitute-path /Users/qt/work/qt C:/Qt/6.7.1/Src 48set substitute-path C:/work/build/qt5_workdir/w/s C:/Qt/6.7.1/Src 49set substitute-path Q:/qt5_workdir/w/s C:/Qt/6.7.1/Src 50set substitute-path c:/Users/qt/work/install C:/Qt/6.7.1/Src 51set substitute-path c:/users/qt/work/qt C:/Qt/6.7.1/Src # directory does not exist: /usr/src/debug/qt5base/src/corelib # directory does not exist: /usr/src/debug/qt5base/src/gui # directory does not exist: /usr/src/debug/qt5base/src/network 52python sys.path.insert(1, 'C:/Qt/Tools/QtCreator/share/qtcreator/debugger') 53python from gdbbridge import * 54python theDumper.loadDumpers({"token":54}) Debugging has failed. 55show version 56show debug-file-directory 57set max-completions 1000 58complete set arch 59set breakpoint pending on 60set print elements 10000 61set index-cache on 62set unwindonsignal on 63set width 0 64set height 0 Setting up inferior... 65set substitute-path /Users/qt/work/qt C:/Qt/6.7.1/Src 66set substitute-path C:/work/build/qt5_workdir/w/s C:/Qt/6.7.1/Src 67set substitute-path Q:/qt5_workdir/w/s C:/Qt/6.7.1/Src 68set substitute-path c:/Users/qt/work/install C:/Qt/6.7.1/Src 69set substitute-path c:/users/qt/work/qt C:/Qt/6.7.1/Src # directory does not exist: /usr/src/debug/qt5base/src/corelib # directory does not exist: /usr/src/debug/qt5base/src/gui # directory does not exist: /usr/src/debug/qt5base/src/network 70python sys.path.insert(1, 'C:/Qt/Tools/QtCreator/share/qtcreator/debugger') 71python from gdbbridge import * 72python theDumper.loadDumpers({"token":72}) Debugging has failed. 73show version 74show debug-file-directory 75set max-completions 1000 76complete set arch 77set breakpoint pending on 78set print elements 10000 79set index-cache on 80set unwindonsignal on 81set width 0 82set height 0 Setting up inferior... 83set substitute-path /Users/qt/work/qt C:/Qt/6.7.1/Src 84set substitute-path C:/work/build/qt5_workdir/w/s C:/Qt/6.7.1/Src 85set substitute-path Q:/qt5_workdir/w/s C:/Qt/6.7.1/Src 86set substitute-path c:/Users/qt/work/install C:/Qt/6.7.1/Src 87set substitute-path c:/users/qt/work/qt C:/Qt/6.7.1/Src # directory does not exist: /usr/src/debug/qt5base/src/corelib # directory does not exist: /usr/src/debug/qt5base/src/gui # directory does not exist: /usr/src/debug/qt5base/src/network 88python sys.path.insert(1, 'C:/Qt/Tools/QtCreator/share/qtcreator/debugger') 89python from gdbbridge import * 90python theDumper.loadDumpers({"token":90}) Debugging has failed. 91show version 92show debug-file-directory 93set max-completions 1000 94complete set arch 95set breakpoint pending on 96set print elements 10000 97set index-cache on 98set unwindonsignal on 99set width 0 100set height 0 Setting up inferior... 101set substitute-path /Users/qt/work/qt C:/Qt/6.7.1/Src 102set substitute-path C:/work/build/qt5_workdir/w/s C:/Qt/6.7.1/Src 103set substitute-path Q:/qt5_workdir/w/s C:/Qt/6.7.1/Src 104set substitute-path c:/Users/qt/work/install C:/Qt/6.7.1/Src 105set substitute-path c:/users/qt/work/qt C:/Qt/6.7.1/Src # directory does not exist: /usr/src/debug/qt5base/src/corelib # directory does not exist: /usr/src/debug/qt5base/src/gui # directory does not exist: /usr/src/debug/qt5base/src/network 106python sys.path.insert(1, 'C:/Qt/Tools/QtCreator/share/qtcreator/debugger') 107python from gdbbridge import * 108python theDumper.loadDumpers({"token":108}) Debugging has 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)
-
@Andrea_Venturelli It's not clear to me what debugger you set in the Kit you're using? Seems to be lldb. With MinGW one is usually using GDB. The GDB debugger is provided as part of the MinGW setup from Qt Online Installer.
-
@jsulm let's see if this helps you a little bit more.
unfortunally i do not understand where I need to search for the informations needed to help you understand why my debugger fails to compile and run.
I'm open to suggestions or direction where to retrive this kind of helpfull information in order to simplify your life and not wasting so much of yours time.
-
@Andrea_Venturelli Please check in the Kit you're using what debugger is set there. It should be GDB from MinGW.
-
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)
-
@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?
-
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
-
@Andrea_Venturelli [Qt creator] >> Edit >> Preferences... >> Kits - then select the Kit you're using
-
this is what I use to create the projects (and using qMake to built):
-
@Andrea_Venturelli Please show ALL settings of that Kit (especially Qt version and debugger set).
-
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)
-
@Andrea_Venturelli Try with Qt for MinGW (not llvm-mingw).
Maybe QtCreator does not support lldb properly. -
It looks like the LLVM MInGW debugger has the wrong debugger type set. It should be
LLDB
and notGDB
.https://bugreports.qt.io/browse/QTBUG-123330 was supposed to be a thing of the past...
-
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?
-
@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. -
okay, finally we did it!
for the other reader who might encounter this problem with the debugger, the solution is:- on the left panel (where it is "Welcome", "Edit", "Design") there is "Projects"
- open projects and under "Built & Run" you have all the kit available
- I switched from Desktop Qt 6.7.1 llvm-mingw 64-bit to Desktop Qt 6.7.1 MinGW 64-bit
- I pressed the "run" button and compile fine.
- after I Run the normal "Debug play button" at the bottom left cornern and now is working
now we can go back to the main issues where this discussion started
-
this is the error I get after deleting the last item in the QTreeWidget:
here the call stack:
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)); } }
-