i compiled cppcheck on Kubuntu with Qt 6.6.
Sadly cppcheck-gui crashes if i stop analyzing the files (Segmentation
fault (core dumped)). I can't reproduce it under Windows.
It also crashes as soon as the last file of my project is finished.
I tried to locate the bug with valgrind. It only told me stuff like:
==7926== Conditional jump or move depends on uninitialised value(s)
I guess, because i didn't compiled with compiler option -g.
There can i set the compiler option. (I am using cmake for compiling).
I also saw in the gui a red warning with "There was a critical warning
with id "preprocessorErrorDirective"..."
Any ideas what I can do to locate the bug?
Merry Christmas!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found how to compile with option -g now. Sadly with valgrind it is very very slow.
But i was able to produce a crash with valgrind and i got this report:
Process terminating with default action of signal 11 (SIGSEGV)
==14654== General Protection Fault
==14654== at 0x5DB4706: QtPrivate::QMetaTypeForType<qmap\<qstring, qvariant=""> >::getDtor()::{lambda(QtPrivate::QMetaTypeInterface const, void)#1}::_FUN(QtPrivate::QMetaTypeInterface const, void) (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Core.so.6.6.0)
==14654== by 0x5DEC13F: QVariant::~QVariant() (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Core.so.6.6.0)
==14654== by 0x55ABB94: QStandardItem::~QStandardItem() (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0x55ABA34: QStandardItem::~QStandardItem() (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0x55AC604: QStandardItem::removeRows(int, int) (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0x55AC817: QStandardItemModel::removeRows(int, int, QModelIndex const&) (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0xB980C4: ResultsTree::clear() (resultstree.cpp:373)
==14654== by 0xBB260C: ResultsView::clear(bool) (resultsview.cpp:122)
==14654== by 0xB3E5F8: MainWindow::clearResults() (mainwindow.cpp:1288)
==14654== by 0xB360EC: MainWindow::doAnalyzeFiles(QList<qstring> const&, bool, bool) (mainwindow.cpp:556)
==14654== by 0xB37EF3: MainWindow::analyzeFiles() (mainwindow.cpp:735)
==14654== by 0xB67145: QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (MainWindow::)()>::call(void (MainWindow::)(), MainWindow, void*) (qobjectdefs_impl.h:145)</qstring></qmap\<qstring,>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hmm... not sure. Maybe resultstree.cpp:373 crashes, because in
mModel.removeRows(0, mModel.rowCount());
the rowCount() might be 0. So it should delete only if rowCount() > 0 ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made a minimum example. In fact there are 2 bugs in cppcheck!
You only need to use the attached file.
Open cppcheck-gui and analyse that file.
You will see a red warning "There was a critical error with id "sntaxError"..." in the cppcheck-gui.
This is the fist bug, but don't care about that bug now!
Just try to analyze the file one more time. Then cppcheck will crash!
You must fix the crash bug first!
As soon that bug is fixed you also need to fix the red warning bug.
ah.. yes. Sorry. That was a bug i done while simplifying my source.
But the crash of cppcheck-gui happens to nearly all my Qt software projects.
Even scanning the cppcheck/gui/ sources crashes. It scans all files and then, as soon as the last file is finished, cppcheck-gui crashes.
Valgrind always complains about a bug in cppcheck like i already wrote above:
==10936== Use of uninitialised value of size 8 [...]
==10936== by 0xB980C4: ResultsTree::clear() (resultstree.cpp:373)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
i compiled cppcheck on Kubuntu with Qt 6.6.
Sadly cppcheck-gui crashes if i stop analyzing the files (Segmentation
fault (core dumped)). I can't reproduce it under Windows.
It also crashes as soon as the last file of my project is finished.
I tried to locate the bug with valgrind. It only told me stuff like:
==7926== Conditional jump or move depends on uninitialised value(s)
I guess, because i didn't compiled with compiler option -g.
There can i set the compiler option. (I am using cmake for compiling).
I also saw in the gui a red warning with "There was a critical warning
with id "preprocessorErrorDirective"..."
Any ideas what I can do to locate the bug?
Merry Christmas!
I found how to compile with option -g now. Sadly with valgrind it is very very slow.
But i was able to produce a crash with valgrind and i got this report:
Process terminating with default action of signal 11 (SIGSEGV)
==14654== General Protection Fault
==14654== at 0x5DB4706: QtPrivate::QMetaTypeForType<qmap\<qstring, qvariant=""> >::getDtor()::{lambda(QtPrivate::QMetaTypeInterface const, void)#1}::_FUN(QtPrivate::QMetaTypeInterface const, void) (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Core.so.6.6.0)
==14654== by 0x5DEC13F: QVariant::~QVariant() (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Core.so.6.6.0)
==14654== by 0x55ABB94: QStandardItem::~QStandardItem() (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0x55ABA34: QStandardItem::~QStandardItem() (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0x55AC604: QStandardItem::removeRows(int, int) (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0x55AC817: QStandardItemModel::removeRows(int, int, QModelIndex const&) (in /home/volker/Qt2/6.6.0/gcc_64/lib/libQt6Gui.so.6.6.0)
==14654== by 0xB980C4: ResultsTree::clear() (resultstree.cpp:373)
==14654== by 0xBB260C: ResultsView::clear(bool) (resultsview.cpp:122)
==14654== by 0xB3E5F8: MainWindow::clearResults() (mainwindow.cpp:1288)
==14654== by 0xB360EC: MainWindow::doAnalyzeFiles(QList<qstring> const&, bool, bool) (mainwindow.cpp:556)
==14654== by 0xB37EF3: MainWindow::analyzeFiles() (mainwindow.cpp:735)
==14654== by 0xB67145: QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (MainWindow::)()>::call(void (MainWindow::)(), MainWindow, void*) (qobjectdefs_impl.h:145)</qstring></qmap\<qstring,>
hmm... not sure. Maybe resultstree.cpp:373 crashes, because in
mModel.removeRows(0, mModel.rowCount());
the rowCount() might be 0. So it should delete only if rowCount() > 0 ?
I made a minimum example. In fact there are 2 bugs in cppcheck!
You only need to use the attached file.
Open cppcheck-gui and analyse that file.
You will see a red warning "There was a critical error with id "sntaxError"..." in the cppcheck-gui.
This is the fist bug, but don't care about that bug now!
Just try to analyze the file one more time. Then cppcheck will crash!
You must fix the crash bug first!
As soon that bug is fixed you also need to fix the red warning bug.
The
syntaxError
is correct:activityplanningform.cpp:3:23: error: Unmatched '('. Configuration: ''. [syntaxError]
ah.. yes. Sorry. That was a bug i done while simplifying my source.
But the crash of cppcheck-gui happens to nearly all my Qt software projects.
Even scanning the cppcheck/gui/ sources crashes. It scans all files and then, as soon as the last file is finished, cppcheck-gui crashes.
Valgrind always complains about a bug in cppcheck like i already wrote above:
==10936== Use of uninitialised value of size 8
[...]
==10936== by 0xB980C4: ResultsTree::clear() (resultstree.cpp:373)