Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Crash on QTimer start - in release, but not in debug



  • Hello,

    I am creating QTimer instance in a class constructor, and use it by calling start() later in the program. I am actually using several timers each in different class.

    But today, suddenly the application crashes every time I call start on specific timer (putting code in comments I am able to see that the timer start() call is responsible for this issue) . In debug session there is no problem, but only in release.
    I have tried to put the timeout handler in comment but it still crashes.

    Is it a memory issue ?
    How can I find the cause of this issue (I am not sure I can install valgrind in my environment, so other method might be better).

    Thanks,
    Ran



  • @ranshalit

    You should post a code snippet with the actual setup of this timer.

    Also a rerun of qmake and a rebuild might help.



  • You can add

    CONFIG += force_debug_info
    

    to your project file. Re-run qmake and rebuild in 'release' mode.



  • Not sure if I did tried a clean build or not, but I will do that first thing in lab. I don't have code snippet now, I'll update later.



  • @mchinand said in Crash on QTimer start - in release, but not in debug:

    force_debug_info

    Hi,
    Thanks., What I can see with force_debug_info ?



  • @ranshalit said in Crash on QTimer start - in release, but not in debug:

    @mchinand said in Crash on QTimer start - in release, but not in debug:

    force_debug_info

    Hi,
    Thanks., What I can see with force_debug_info ?

    Debug this build, It will have debugging info, but is otherwise a release build.



  • This post is deleted!


  • Hello,

    Is started again, not sure why. Only in release - in debug there is no issue.
    clean build did not help.
    I tried adding force_debug_info - but it did not help.

    is there any idea ?

    Thank you!
    Ran



  • @ranshalit

    The force_debug_info probably forces to add additional output when crashing. This should help find the location, but it will not cure the problem.

    Can you pin the problem to one specific timer?
    That would give you at least a lead where check.

    In general it sounds like a pointer is being corrupted. Either directly a timer pointer or some other pointer writing randomly all over the place. In most debug versions pointer are initialized with zero and in release versions this is not the case in general.

    Sometimes people declare pointers somewhere and check them lateron, if they have been assigned already (e.g. by checking for zero). It happens fast to forget an immediate zero initialzation and the problem will pop up nly in release version later on.

    Sorry, I can give you only such general remarks, which might be known to you already.


Log in to reply