Results 1 to 14 of 14

Thread: Crash on QApplication::exec()

  1. #1
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    1

    Default Crash on QApplication::exec()

    Hi there, I'm trying to port an application from CentOS to Mac OSX. I got the code to compile, but a segmentation fault occurs on QApplication::exec() when it is run, giving the error:

    Qt Code:
    1. 2011-04-04 14:26:41.907 vmfdebuger[1979:903] -[NSCFArray name]: unrecognized selector sent to instance 0x102d9d3f0
    2. Qt has caught an exception thrown from an event handler. Throwing
    3. exceptions from an event handler is not supported in Qt. You must
    4. reimplement QApplication::notify() and catch all exceptions there.
    To copy to clipboard, switch view to plain text mode 

    This did not happen on CentOs. Any hints on what I might have missed?

    Here is the main method. Everything works ok until it gets to app.exec().

    Qt Code:
    1. #include <QApplication>
    2. #include <iostream>
    3. #include <fstream>
    4. #include <QTime>
    5. #include "qdebugstream.h"
    6. #include "vmfdebuger.h"
    7. #include "configmanager.h"
    8. #include "ConsoleLog.h"
    9.  
    10. #include "loadsaveddata.h"
    11.  
    12. using namespace std;
    13.  
    14.  
    15. int main(int argc, char *argv[])
    16. {
    17. QApplication app(argc, argv);
    18.  
    19. QString fileName;
    20.  
    21. if (argc > 1)
    22. fileName = QString(argv[1]);
    23.  
    24. VMFDebuger mainWin(0, argc, argv );
    25.  
    26. // redirect cerr and cout to console window
    27. QTextEdit* console = mainWin.getConsoleWindow();
    28. QDebugStream qout(std::cout, console);
    29. QDebugStream qerr(std::cerr, console);
    30.  
    31. ConsoleLog::setConsoleWidget(mainWin.getConsoleWindow());
    32. ConsoleLog::dumpBufferToConsoleWindow();
    33.  
    34. ConsoleLog::getInstance(mainWin.getConsoleWindow());
    35.  
    36.  
    37. //for file logging:
    38. ofstream logfile;
    39. logfile.open("C:/logfile.txt", ios::app);
    40. logfile << QTime::currentTime().toString().toAscii().data() << "Start Logging...... \n";
    41. logfile.flush();
    42.  
    43. mainWin.show();
    44.  
    45. return app.exec();
    46. }
    To copy to clipboard, switch view to plain text mode 
    Here is the error report from the os:

    Qt Code:
    1. Code Type: X86-64 (Native)
    2. Parent Process: Qt Creator [93099]
    3.  
    4. Date/Time: 2011-04-04 15:08:18.732 -0400
    5. OS Version: Mac OS X Server 10.6.7 (10J869)
    6. Report Version: 6
    7.  
    8. Interval Since Last Report: 111952 sec
    9. Crashes Since Last Report: 24
    10. Per-App Crashes Since Last Report: 24
    11. Anonymous UUID: 704E20B4-A73C-44F5-807E-3A063AA83650
    12.  
    13. Exception Type: EXC_CRASH (SIGABRT)
    14. Exception Codes: 0x0000000000000000, 0x0000000000000000
    15. Crashed Thread: 0 Dispatch queue: com.apple.main-thread
    16.  
    17. Application Specific Information:
    18. abort() called
    19.  
    20. Thread 0 Crashed: Dispatch queue: com.apple.main-thread
    21. 0 libSystem.B.dylib 0x00007fff82f3e5d6 __kill + 10
    22. 1 libSystem.B.dylib 0x00007fff82fdecd6 abort + 83
    23. 2 libSystem.B.dylib 0x00007fff82f5ec52 _Unwind_Resume + 66
    24. 3 vmfdebuger 0x00000001000306c6 main + 831 (main.cpp:56)
    25. 4 vmfdebuger 0x0000000100005136 _start + 224
    26. 5 vmfdebuger 0x0000000100005055 start + 33
    27.  
    28. Thread 1: Dispatch queue: com.apple.libdispatch-manager
    29. 0 libSystem.B.dylib 0x00007fff82f0912a kevent + 10
    30. 1 libSystem.B.dylib 0x00007fff82f0affd _dispatch_mgr_invoke + 154
    31. 2 libSystem.B.dylib 0x00007fff82f0acd4 _dispatch_queue_invoke + 185
    32. 3 libSystem.B.dylib 0x00007fff82f0a7fe _dispatch_worker_thread2 + 252
    33. 4 libSystem.B.dylib 0x00007fff82f0a128 _pthread_wqthread + 353
    34. 5 libSystem.B.dylib 0x00007fff82f09fc5 start_wqthread + 13
    35.  
    36. Thread 2:
    37. 0 libSystem.B.dylib 0x00007fff82f09f4a __workq_kernreturn + 10
    38. 1 libSystem.B.dylib 0x00007fff82f0a35c _pthread_wqthread + 917
    39. 2 libSystem.B.dylib 0x00007fff82f09fc5 start_wqthread + 13
    40.  
    41. Thread 0 crashed with X86 Thread State (64-bit):
    42. rax: 0x0000000000000000 rbx: 0x0000000102da96c0 rcx: 0x00007fff5fbfeff8 rdx: 0x0000000000000000
    43. rdi: 0x0000000000000b95 rsi: 0x0000000000000006 rbp: 0x00007fff5fbff010 rsp: 0x00007fff5fbfeff8
    44. r8: 0x0000000000005034 r9: 0x000000000000000b r10: 0x00007fff82f3a616 r11: 0xffffff80002e28b0
    45. r12: 0x00007fff5fbff020 r13: 0x00007fff5fbffb08 r14: 0x0000000000000001 r15: 0x0000000000000000
    46. rip: 0x00007fff82f3e5d6 rfl: 0x0000000000000206 cr2: 0x0000000102969f40
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance for any help.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash on QApplication::exec()

    What does vmfdebuger do? It seems to be the source of the crash.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    1

    Default Re: Crash on QApplication::exec()

    vmfdebuger is the main application window. It's very long so I can't post it all here... but its constructor does connect a lot of signals and slots, and I read that exceptions in slots can cause this crash. This never happened before though, it ran fine on Linux with no exceptions in the slots. Are there any common pieces of code that need to be changed to run on the mac?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash on QApplication::exec()

    Are you throwing any exceptions yourself anywhere?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    1

    Default Re: Crash on QApplication::exec()

    No, I am not.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash on QApplication::exec()

    What is in line #56 of your main.cpp?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    1

    Default Re: Crash on QApplication::exec()

    Ah, the line numbers don't match up exactly as I removed some commented out lines from my post. Line 56 refers to the closing brace of the method, line 46 in the code I posted above.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash on QApplication::exec()

    In that case the crash occurs when destructors are called (most probably the destructor of your vmfdebuger class). Could you post a full debugger backtrace with the binary built in debug mode?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    1

    Default Re: Crash on QApplication::exec()

    Here is the application output for debug mode. Apparently QT wasn't installed correctly, but I don't know how it even compiles if it can't find QtCore, etc? I have no idea where that world clock stuff is coming from. Sorry for my ignorance, but how do I do a proper back trace?


    Qt Code:
    1. Unable to read symbols for QtSql.framework/Versions/4/QtSql (file not found).
    2. Unable to read symbols from "QtSql" (not yet mapped into memory).
    3. Unable to read symbols for QtXml.framework/Versions/4/QtXml (file not found).
    4. Unable to read symbols from "QtXml" (not yet mapped into memory).
    5. Unable to read symbols for QtGui.framework/Versions/4/QtGui (file not found).
    6. Unable to read symbols from "QtGui" (not yet mapped into memory).
    7. Unable to read symbols for QtNetwork.framework/Versions/4/QtNetwork (file not found).
    8. Unable to read symbols from "QtNetwork" (not yet mapped into memory).
    9. Unable to read symbols for QtCore.framework/Versions/4/QtCore (file not found).
    10. Unable to read symbols from "QtCore" (not yet mapped into memory).
    11. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/customwidgetplugin/.obj/debug-shared/analogclock.o" - no debug information available for "analogclock.cpp".
    12. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/customwidgetplugin/.obj/debug-shared/customwidgetplugin.o" - no debug information available for "customwidgetplugin.cpp".
    13. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/customwidgetplugin/.obj/debug-shared/moc_analogclock.o" - no debug information available for ".moc/debug-shared/moc_analogclock.cpp".
    14. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/customwidgetplugin/.obj/debug-shared/moc_customwidgetplugin.o" - no debug information available for ".moc/debug-shared/moc_customwidgetplugin.cpp".
    15. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/worldtimeclockplugin/.obj/debug-shared/worldtimeclock.o" - no debug information available for "worldtimeclock.cpp".
    16. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/worldtimeclockplugin/.obj/debug-shared/worldtimeclockplugin.o" - no debug information available for "worldtimeclockplugin.cpp".
    17. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/worldtimeclockplugin/.obj/debug-shared/moc_worldtimeclock.o" - no debug information available for ".moc/debug-shared/moc_worldtimeclock.cpp".
    18. Could not find object file "/private/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/examples/designer/worldtimeclockplugin/.obj/debug-shared/moc_worldtimeclockplugin.o" - no debug information available for ".moc/debug-shared/moc_worldtimeclockplugin.cpp".
    19. 2011-04-04 17:05:25.579 vmfdebuger[6072:a0f] -[NSCFArray name]: unrecognized selector sent to instance 0x102ea6650
    20. Qt has caught an exception thrown from an event handler. Throwing
    21. exceptions from an event handler is not supported in Qt. You must
    22. reimplement QApplication::notify() and catch all exceptions there.
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash on QApplication::exec()

    It seems you have no debugging symbols for the libraries installed.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    1

    Default Re: Crash on QApplication::exec()

    Hi sorry about the delay but I've finally been able to get back to this. I have the QtCore, QtGui, etc frameworks installed in /Library/Frameworks/. How to I get the symbols to load properly?

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash on QApplication::exec()

    Do you have the debugging symbols for those libraries? Did you build Qt in both release and debug mode?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    1

    Default Re: Crash on QApplication::exec()

    Yes, I built Qt as frameworks, and the debug symbols are contained in the frameworks. I can't seem to change where it is looking for them from for example QtGui.framework/Versions/4/QtGui, where it is trying to find them, to /Library/Frameworks/QtGui.framework/Versions/4/QtGui where they are located.

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash on QApplication::exec()

    Quote Originally Posted by Nivek View Post
    Yes, I built Qt as frameworks, and the debug symbols are contained in the frameworks.
    Apparently not if the debugger can't find them.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QThread::exec and QApplication instantiation
    By Ray Froehlich in forum Qt Programming
    Replies: 1
    Last Post: 28th July 2010, 05:35
  2. Replies: 4
    Last Post: 1st December 2008, 11:13
  3. Quitting before the QApplication::exec()
    By jsmax in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2008, 20:19
  4. Replies: 2
    Last Post: 16th March 2007, 09:04
  5. <QtGui/QApplication> vs. <QApplication>
    By seneca in forum Qt Programming
    Replies: 5
    Last Post: 25th January 2006, 10:58

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.