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:
2011-04-04 14:26:41.907 vmfdebuger[1979:903] -[NSCFArray name]: unrecognized selector sent to instance 0x102d9d3f0
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement
QApplication::notify() and
catch all exceptions there.
2011-04-04 14:26:41.907 vmfdebuger[1979:903] -[NSCFArray name]: unrecognized selector sent to instance 0x102d9d3f0
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
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().
#include <QApplication>
#include <iostream>
#include <fstream>
#include <QTime>
#include "qdebugstream.h"
#include "vmfdebuger.h"
#include "configmanager.h"
#include "ConsoleLog.h"
#include "loadsaveddata.h"
using namespace std;
int main(int argc, char *argv[])
{
if (argc > 1)
VMFDebuger mainWin(0, argc, argv );
// redirect cerr and cout to console window
QTextEdit* console
= mainWin.
getConsoleWindow();
QDebugStream qout(std::cout, console);
QDebugStream qerr(std::cerr, console);
ConsoleLog::setConsoleWidget(mainWin.getConsoleWindow());
ConsoleLog::dumpBufferToConsoleWindow();
ConsoleLog::getInstance(mainWin.getConsoleWindow());
//for file logging:
ofstream logfile;
logfile.open("C:/logfile.txt", ios::app);
logfile <<
QTime::currentTime().
toString().
toAscii().
data() <<
"Start Logging...... \n";
logfile.flush();
mainWin.show();
return app.exec();
}
#include <QApplication>
#include <iostream>
#include <fstream>
#include <QTime>
#include "qdebugstream.h"
#include "vmfdebuger.h"
#include "configmanager.h"
#include "ConsoleLog.h"
#include "loadsaveddata.h"
using namespace std;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString fileName;
if (argc > 1)
fileName = QString(argv[1]);
VMFDebuger mainWin(0, argc, argv );
// redirect cerr and cout to console window
QTextEdit* console = mainWin.getConsoleWindow();
QDebugStream qout(std::cout, console);
QDebugStream qerr(std::cerr, console);
ConsoleLog::setConsoleWidget(mainWin.getConsoleWindow());
ConsoleLog::dumpBufferToConsoleWindow();
ConsoleLog::getInstance(mainWin.getConsoleWindow());
//for file logging:
ofstream logfile;
logfile.open("C:/logfile.txt", ios::app);
logfile << QTime::currentTime().toString().toAscii().data() << "Start Logging...... \n";
logfile.flush();
mainWin.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Here is the error report from the os:
Code Type: X86-64 (Native)
Parent Process: Qt Creator [93099]
Date/Time: 2011-04-04 15:08:18.732 -0400
OS Version: Mac OS X Server 10.6.7 (10J869)
Report Version: 6
Interval Since Last Report: 111952 sec
Crashes Since Last Report: 24
Per-App Crashes Since Last Report: 24
Anonymous UUID: 704E20B4-A73C-44F5-807E-3A063AA83650
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
abort() called
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libSystem.B.dylib 0x00007fff82f3e5d6 __kill + 10
1 libSystem.B.dylib 0x00007fff82fdecd6 abort + 83
2 libSystem.B.dylib 0x00007fff82f5ec52 _Unwind_Resume + 66
3 vmfdebuger 0x00000001000306c6 main + 831 (main.cpp:56)
4 vmfdebuger 0x0000000100005136 _start + 224
5 vmfdebuger 0x0000000100005055 start + 33
Thread 1: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x00007fff82f0912a kevent + 10
1 libSystem.B.dylib 0x00007fff82f0affd _dispatch_mgr_invoke + 154
2 libSystem.B.dylib 0x00007fff82f0acd4 _dispatch_queue_invoke + 185
3 libSystem.B.dylib 0x00007fff82f0a7fe _dispatch_worker_thread2 + 252
4 libSystem.B.dylib 0x00007fff82f0a128 _pthread_wqthread + 353
5 libSystem.B.dylib 0x00007fff82f09fc5 start_wqthread + 13
Thread 2:
0 libSystem.B.dylib 0x00007fff82f09f4a __workq_kernreturn + 10
1 libSystem.B.dylib 0x00007fff82f0a35c _pthread_wqthread + 917
2 libSystem.B.dylib 0x00007fff82f09fc5 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000102da96c0 rcx: 0x00007fff5fbfeff8 rdx: 0x0000000000000000
rdi: 0x0000000000000b95 rsi: 0x0000000000000006 rbp: 0x00007fff5fbff010 rsp: 0x00007fff5fbfeff8
r8: 0x0000000000005034 r9: 0x000000000000000b r10: 0x00007fff82f3a616 r11: 0xffffff80002e28b0
r12: 0x00007fff5fbff020 r13: 0x00007fff5fbffb08 r14: 0x0000000000000001 r15: 0x0000000000000000
rip: 0x00007fff82f3e5d6 rfl: 0x0000000000000206 cr2: 0x0000000102969f40
Code Type: X86-64 (Native)
Parent Process: Qt Creator [93099]
Date/Time: 2011-04-04 15:08:18.732 -0400
OS Version: Mac OS X Server 10.6.7 (10J869)
Report Version: 6
Interval Since Last Report: 111952 sec
Crashes Since Last Report: 24
Per-App Crashes Since Last Report: 24
Anonymous UUID: 704E20B4-A73C-44F5-807E-3A063AA83650
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
abort() called
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libSystem.B.dylib 0x00007fff82f3e5d6 __kill + 10
1 libSystem.B.dylib 0x00007fff82fdecd6 abort + 83
2 libSystem.B.dylib 0x00007fff82f5ec52 _Unwind_Resume + 66
3 vmfdebuger 0x00000001000306c6 main + 831 (main.cpp:56)
4 vmfdebuger 0x0000000100005136 _start + 224
5 vmfdebuger 0x0000000100005055 start + 33
Thread 1: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x00007fff82f0912a kevent + 10
1 libSystem.B.dylib 0x00007fff82f0affd _dispatch_mgr_invoke + 154
2 libSystem.B.dylib 0x00007fff82f0acd4 _dispatch_queue_invoke + 185
3 libSystem.B.dylib 0x00007fff82f0a7fe _dispatch_worker_thread2 + 252
4 libSystem.B.dylib 0x00007fff82f0a128 _pthread_wqthread + 353
5 libSystem.B.dylib 0x00007fff82f09fc5 start_wqthread + 13
Thread 2:
0 libSystem.B.dylib 0x00007fff82f09f4a __workq_kernreturn + 10
1 libSystem.B.dylib 0x00007fff82f0a35c _pthread_wqthread + 917
2 libSystem.B.dylib 0x00007fff82f09fc5 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000102da96c0 rcx: 0x00007fff5fbfeff8 rdx: 0x0000000000000000
rdi: 0x0000000000000b95 rsi: 0x0000000000000006 rbp: 0x00007fff5fbff010 rsp: 0x00007fff5fbfeff8
r8: 0x0000000000005034 r9: 0x000000000000000b r10: 0x00007fff82f3a616 r11: 0xffffff80002e28b0
r12: 0x00007fff5fbff020 r13: 0x00007fff5fbffb08 r14: 0x0000000000000001 r15: 0x0000000000000000
rip: 0x00007fff82f3e5d6 rfl: 0x0000000000000206 cr2: 0x0000000102969f40
To copy to clipboard, switch view to plain text mode
Thanks in advance for any help.
Bookmarks