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

[Solved]solving random crashes on reactivate application window



  • I'm getting random crashes on my Qt application,here is the thing:my program has several thread which works fine on background,and it runs a couple of hour for good,and then it crashed when I switch back to program window."Access Violation" on Normal mode,"Segment fault" on Debug mode.
    And this "Segment fault" is the only message I got,there is no other debug output at all,and I checked call stack but got nothing,after recur this bug several times,I found a qBadAlloc() into it.
    I thought it was a memory leak or something else,but after checking memory usage,the usage didn't grow big at all.
    I can not use Valgrind to check my code,because my environment limit me to use mingw on Windows 7.
    So I was kind of stuck here,this bug is really fatal,any suggestions will be grateful.

    EDIT:
    The program is not immediately crash on reactive app window,but switch from different window will boost the crash happen,otherwise it will working normally for a long time.
    EDIT:
    After a lot of windows switch,finally I got some message useful on debug output window.
    @
    HEAP[Server.exe]:
    Invalid address specified to RtlFreeHeap( 003F0000, 25259B88 )
    @
    EDIT:
    My interface was based on qml.



  • Without seeing source code and or a core dump it is hard to say where is a problem. Looks like you trying to use un-allocated memory somewhere.
    I would suggest to run the app under debugger or add some debug printing at the places that are activated on window switch.



  • [quote author="andreyc" date="1417020716"]Without seeing source code and or a core dump it is hard to say where is a problem. Looks like you trying to use un-allocated memory somewhere.
    I would suggest to run the app under debugger or add some debug printing at the places that are activated on window switch.[/quote]

    Thanks for your tips,my thread routine is a running cycle,and I didn't new any object for work.
    I didn't un-allocated memory manually.



  • @
    Some backtrace
    @



  • @
    Some backtrace
    @



  • @
    Some backtrace
    @



  • @
    Some backtrace
    @



  • @
    Some backtrace
    @



  • After a deep core dump,I found out what happened,I was using QTime::currentTime() within Thread,QTime are not documented as being concurrent,so it causes this werid bug.fixed.


Log in to reply