[Solved] Crash in release mode



  • I have a larger application built using Qt 5.4. It works very well in debug mode. However, when running the version compiled with the release mode the application crashes once I click an icon in my QToolBar:

    DBusMenuExporterPrivate::addAction(): Already tracking Action XXX under id YYY

    Can anyone give me a hint how to debug this? In release mode I don't have the debugging symbols available so the debugger doesn't help me at all.
    I create an action and add it to a QMenu and the QToolBar. I assume that this is not a problem because that is how QActions are supposed to be used, right?

    Anyway, I would be thankful for any hint. Google didn't help much and I cannot debug this.



  • try these flags in your qmake:

    QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
    QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO

    if it is not enough, build your app on linux and use valgrind.



  • Thank you, these macros are very helpful.

    The error turned out to be that I did: Q_ASSERT(_activeProject->open()); without knowing that Q_ASSERT() has no effect in Release mode (when QT_NO_DEBUG IS TRUE).
    The error message I got (the one I stated in my first post) was therefore completely unrelated to this issue.

    Thank you for the help!


  • Lifetime Qt Champion

    Hi,

    Q_ASSERT follows the same rules as assert that's why it doesn't do anything in release mode. A rule of thumb is to always check the returned value and not the function itself



  • @SGaist Thank you for the advice. This is definitely a rule I will always follow from now on :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.