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. [SOLVED] Linux, Qt 5.2.1: C++/QML application crash only in debug mode

[SOLVED] Linux, Qt 5.2.1: C++/QML application crash only in debug mode

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.4k 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.
  • N Offline
    N Offline
    nbertin
    wrote on last edited by
    #1

    Hi,

    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)...
    __strlen_sse2
    QCoreApplication::arguments()
    ??
    ??
    _SmcProcessMessage
    IceProcessMessage
    ...

    Thank you for help!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Could you post full backtrace from a core file and your source code related to the backtrace.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nbertin
        wrote on last edited by
        #3

        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 !

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          Glad to hear that the is resolved. Thank you for sharing your investigation results.

          1 Reply Last reply
          0

          • Login

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