[SOLVED] Linux, Qt 5.2.1: C++/QML application crash only in debug mode
I'm looking for advice / tips on how to debug this strange issue.
My host/target system is Linux (Ubuntu 12.04LTS 64bits) and Qt5.2.1
1- the application (C++ & QML) compiled in release mode is running without any issue
2- the same application compiled in debug mode is crashing in the QApplication exec() method
3- the same application compiled in debug mode but started with valgrind is not crashing
The backtrace is always the same, but doesn't give much information (at least to me)...
Thank you for help!
Could you post full backtrace from a core file and your source code related to the backtrace.
Unfortunately, I can't disclose the source code and it's a quite big project! It's running already on Win32 and OSX and we are porting it to Linux (desktop first and then, to a Freescale i.MX6 hardware).
Anyway, I've finally found and fixed the issue!
Early in the code, a factory instantiates a QApplication or QtSingleApplication with argc and argv as parameters.
In debug mode, the "-qmljsdebugger=port:...,block" argument is added (but not in release mode, which explain why it doesn't crash). This argument is removed (by QApplication?) and argc/argv are updated accordingly.
Because argc was not passed by reference to the factory, its value was wrong on return (+1 compared to the number of entries in argv) = crashes when Qt tries to get the length of a non-existant argument !
Glad to hear that the is resolved. Thank you for sharing your investigation results.