We have an OS X C++ application, using Qt 5.5 that provides a simple HTTP server interface. It's essentially similar to the Fortune Server example provided by Qt (http://doc.qt.io/qt-5/qtnetwork-fortuneserver-example.html), but what we're seeing is that occasionally the application is seg faulting upon shutdown, with the following stack trace (thread 6 crashing):
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8deb4fca __open + 10
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8deb6232 kevent64 + 10
1 libdispatch.dylib 0x00007fff90f0426e _dispatch_mgr_thread + 52
Thread 2:
0 libsystem_kernel.dylib 0x00007fff8deb594a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff887833dd start_wqthread + 13
Thread 3:
0 libsystem_kernel.dylib 0x00007fff8deb594a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff887833dd start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff8deb594a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff887833dd start_wqthread + 13
Thread 5:: Dispatch queue: com.apple.NSXPCConnection.m-user.com.apple.airportd
0 libsystem_platform.dylib 0x00007fff8923378d _os_lock_handoff_lock + 23
1 libobjc.A.dylib 0x00007fff83258906 objc_object::sidetable_clearDeallocating() + 64
2 libobjc.A.dylib 0x00007fff8323e651 objc_destructInstance + 145
3 libobjc.A.dylib 0x00007fff8323e595 object_dispose + 22
4 com.apple.CoreFoundation 0x00007fff84eea448 -[__NSArrayM dealloc] + 376
5 libobjc.A.dylib 0x00007fff8325889c objc_object::sidetable_release(bool) + 236
6 com.apple.Foundation 0x00007fff85747909 -[_NSXPCInterfaceMethodInfo dealloc] + 63
7 libobjc.A.dylib 0x00007fff8325889c objc_object::sidetable_release(bool) + 236
8 com.apple.CoreFoundation 0x00007fff84ed5db0 CFRelease + 304
9 com.apple.CoreFoundation 0x00007fff84ee5b92 __CFBasicHashDrain + 498
10 com.apple.CoreFoundation 0x00007fff84ed5e8e CFRelease + 526
11 com.apple.Foundation 0x00007fff8578dd7a -[NSXPCInterface dealloc] + 28
12 libobjc.A.dylib 0x00007fff8325889c objc_object::sidetable_release(bool) + 236
13 com.apple.Foundation 0x00007fff8578df0c -[NSXPCConnection dealloc] + 281
14 libobjc.A.dylib 0x00007fff8325889c objc_object::sidetable_release(bool) + 236
15 libsystem_blocks.dylib 0x00007fff8d3166e5 _Block_release + 196
16 libdispatch.dylib 0x00007fff90effe73 _dispatch_client_callout + 8
17 libdispatch.dylib 0x00007fff90f035cd _dispatch_queue_drain + 1100
18 libdispatch.dylib 0x00007fff90f03030 _dispatch_queue_invoke + 202
19 libdispatch.dylib 0x00007fff90f02bef _dispatch_root_queue_drain + 463
20 libdispatch.dylib 0x00007fff90f02a1c _dispatch_worker_thread3 + 91
21 libsystem_pthread.dylib 0x00007fff88785a9d _pthread_wqthread + 729
22 libsystem_pthread.dylib 0x00007fff887833dd start_wqthread + 13
Thread 6 Crashed:: Qt bearer thread
0 org.qt-project.QtNetwork 0x0000000100a541cb QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() + 107
1 org.qt-project.QtNetwork 0x0000000100a5431e QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() + 14
2 org.qt-project.QtCore 0x0000000100d72427 QObject::event(QEvent*) + 823
3 org.qt-project.QtCore 0x0000000100d49588 QCoreApplication::notify(QObject*, QEvent*) + 104
4 org.qt-project.QtCore 0x0000000100d4a212 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 1058
5 org.qt-project.QtCore 0x0000000100d997db QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 59
6 org.qt-project.QtCore 0x0000000100d46c1c QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 412
7 org.qt-project.QtCore 0x0000000100b9c07e QThread::exec() + 110
8 org.qt-project.QtCore 0x0000000100b9fc02 QThreadPrivate::start(void*) + 338
9 libsystem_pthread.dylib 0x00007fff8878605a _pthread_body + 131
10 libsystem_pthread.dylib 0x00007fff88785fd7 _pthread_start + 176
11 libsystem_pthread.dylib 0x00007fff887833ed thread_start + 13
As you can see, thread 0 is done - we're outside main. I'm sure there's some cleanup code I'm failing to call when we're disposing of our resources, but I don't know what it can be.
Without putting all our source up here, the basic chain of calls were doing is:
class RestServer : public QObject {
RestServer::RestServer() {
_tcpServer = new QTcpServer(this);
}
void RestServer::listen(quint16 port)
{
if (!_tcpServer->listen(QHostAddress::LocalHost, port)) {
LOG_ERROR("RestServer", "Failed to start server at: " << port);
throw std::exception();
}
_portNum = _tcpServer->serverPort();
LOG_INFO("RestServer", "Server is listening at: " << _portNum);
connect(_tcpServer, SIGNAL(newConnection()), this, SLOT(connectSocket()));
}
Then in our test code, we basically do:
void RestAPIServer_test::responseCallback(QNetworkReply *reply)
{
auto response = reply->readAll();
_uri = response;
reply->close();
QCoreApplication::exit();
}
TEST_F(RestAPIServer_test, urlWithPercents)
{
RestServer restServer();
restServer.listen(0);
quint16 port = restServer.serverPort();
// "widget/foo bar.txt"
QUrl serviceUrl(QString("http://localhost:%1/path/?path=widget%2Ffoo%20bar.txt").arg(port));
QNetworkAccessManager networkManager(this);
connect(&networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(responseCallback(QNetworkReply*)));
QNetworkRequest request(serviceUrl);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
networkManager.get(request);
QCoreApplication::exec();
ASSERT_EQ(QString("path=widget/foo bar.txt"), _uri);
}
It is not safe to instantiate a QObject on stack with a parent. Look at the line
QNetworkAccessManager networkManager(this);
The object would be destroyed twice, which is not possible, so you see the crash. Change that line as follows (of course, the use of variable networkManager must also be updated):
QNetworkAccessManager* networkManager=new QNetworkAccessManager(this);
The problem seemed to be due to some networking-related threads created by Qt still running for a bit after the call to QCoreApplication::quit() was called, probably because the quit() was called from within the callback function registered with the QTcpSocket. The solution was to put a 1-second sleep after the call to exit:
void RestAPIServer_test::responseCallback(QNetworkReply *reply)
{
auto response = reply->readAll();
_uri = response;
reply->close();
QCoreApplication::exit();
// This prevents a shutdown race condition where Qt service
// threads continue to run after the call to exit().
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
Related
Getting a runtime crash when removing uiviewrepresentable of a collection view using compositional layout and a diffable data source from the screen. The view is currently in an if statement, if no data is found it uses a empty data view instead of showing the collection.
if collectionViewModel.showEmptyDataView{
EmptyDataSetViewWithBuilder(title: collectionViewModel.errorDataTilte, description: collectionViewModel.errorDataDescription, image: Constants.EmptyDataSetImages.errorIcon, addButton: false, cartStyle: Themes.CartViewTheme) {
//ViewBuilder
}
}else{
HomeScreenCollectionView(ShopViewModel: collectionViewModel) { itemClicked in
//handle item clicked
}
}
The quick fix I found was to remove the if statements and use an opacity modifier instead.
EmptyDataSetViewWithBuilder(title: collectionViewModel.errorDataTilte, description: collectionViewModel.errorDataDescription, image: Constants.EmptyDataSetImages.errorIcon, addButton: false, cartStyle: Themes.CartViewTheme) {
//ViewBuilder
}.opacity(collectionViewModel.showEmptyDataView ? 1 : 0).zIndex(collectionViewModel.showEmptyDataView ? 1 : 0)
HomeScreenCollectionView(ShopViewModel: collectionViewModel) { itemClicked in
//handle item clicked
}.opacity(!collectionViewModel.showEmptyDataView ? 1 : 0).zIndex(!collectionViewModel.showEmptyDataView ? 1 : 0)
This only occurs in IOS 15, I am also seeing this log within console [UICollectionViewRecursion] cv == 0x106131c00 Disabling recursion trigger logging i haven't seen this log in previous OS's. Another thing i noticed was this runtime crash occurs more often on the release build configuration. Really like compositional layouts and diffable data source so id to continue to use this throughout ios 15. But would like to make sure that this bug doesn't keep occurring. It crashes the app especially in test flight/ appstore
The crash report is saying its crashing on _AppearanceActionModifier.MergedBox.disappear+ 3049112
Heres full crash report:
Hardware Model: iPhone13,4
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Date/Time: 2021-10-12 17:48:13.6141 -0400
Launch Time: 2021-10-12 17:48:13.2125 -0400
OS Version: iPhone OS 15.0.1 (19A348)
Release Type: User
Baseband Version: 2.09.10
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000018923f698
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL; [5]
Terminating Process: exc handler [7627]
Terminating Process: exc handler [7627]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 SwiftUI 0x18923f698 _AppearanceActionModifier.MergedBox.disappear+ 3049112 () + 28
1 SwiftUI 0x1894f9ea4 implicit closure #4 in implicit closure #3 in _AppearanceActionModifier.MergedCallbacks.value.getter + 24
2 SwiftUI 0x189068720 thunk for #escaping #callee_guaranteed () -> + 1120032 () + 28
3 SwiftUI 0x188f8e8fc thunk for #escaping #callee_guaranteed () -> (#out + 227580 ()) + 28
4 SwiftUI 0x189068720 thunk for #escaping #callee_guaranteed () -> + 1120032 () + 28
5 SwiftUI 0x188f6ce68 closure #1 in ViewRendererHost.render+ 89704 (interval:updateDisplayList:) + 2596
6 SwiftUI 0x189033f78 ViewRendererHost.render+ 905080 (interval:updateDisplayList:) + 336
7 SwiftUI 0x188f7fe18 _UIHostingView.layoutSubviews+ 167448 () + 312
8 SwiftUI 0x188f83b24 #objc _UIHostingView.layoutSubviews+ 183076 () + 28
9 UIKitCore 0x183b5ecc8 -[UIView+ 1629384 (CALayerDelegate) layoutSublayersOfLayer:] + 2620
10 QuartzCore 0x1852b8280 CA::Layer::layout_if_needed+ 258688 (CA::Transaction*) + 536
11 QuartzCore 0x1852aaaa8 CA::Layer::layout_and_display_if_needed+ 203432 (CA::Transaction*) + 144
12 QuartzCore 0x1852bf0b0 CA::Context::commit_transaction+ 286896 (CA::Transaction*, double, double*) + 500
13 QuartzCore 0x1852c8174 CA::Transaction::commit+ 323956 () + 680
14 QuartzCore 0x1852aa210 CA::Transaction::flush_as_runloop_observer+ 201232 (bool) + 88
15 UIKitCore 0x183f15c28 _UIApplicationFlushCATransaction + 76
16 UIKitCore 0x1841afad8 _UIUpdateSequenceRun + 84
17 UIKitCore 0x184827294 schedulerStepScheduledMainSection + 144
18 UIKitCore 0x184826760 runloopSourceCallback + 60
19 CoreFoundation 0x1815e2030 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
20 CoreFoundation 0x1815f2cf0 __CFRunLoopDoSource0 + 208
21 CoreFoundation 0x18152cff8 __CFRunLoopDoSources0 + 268
22 CoreFoundation 0x181532804 __CFRunLoopRun + 820
23 CoreFoundation 0x1815463c8 CFRunLoopRunSpecific + 600
24 GraphicsServices 0x19cd5738c GSEventRunModal + 164
25 UIKitCore 0x183eec0bc -[UIApplication _run] + 1100
26 UIKitCore 0x183c69be8 UIApplicationMain + 2124
27 SwiftUI 0x189195d90 closure #1 in KitRendererCommon+ 2354576 (_:) + 164
28 SwiftUI 0x1890c2ebc runApp<A>+ 1490620 (_:) + 252
29 SwiftUI 0x1890a4278 static App.main+ 1364600 () + 128
30 Development 0x102bddb90 main + 23440 (<compiler-generated>:0)
31 dyld 0x1060eda24 start + 520
Thread 1:
0 libsystem_pthread.dylib 0x1f19fcf48 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x1f19fcf48 start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x1f19fcf48 start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x1f19fcf48 start_wqthread + 0
Thread 5 name: com.apple.uikit.eventfetch-thread
Thread 5:
0 libsystem_kernel.dylib 0x1b800a564 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b800abfc mach_msg + 76
2 CoreFoundation 0x18152e698 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x18153298c __CFRunLoopRun + 1212
4 CoreFoundation 0x1815463c8 CFRunLoopRunSpecific + 600
5 Foundation 0x182d69d54 -[NSRunLoop+ 101716 (NSRunLoop) runMode:beforeDate:] + 236
6 Foundation 0x182dab6a8 -[NSRunLoop+ 370344 (NSRunLoop) runUntilDate:] + 92
7 UIKitCore 0x183e6507c -[UIEventFetcher threadMain] + 524
8 Foundation 0x182db995c __NSThread__start__ + 792
9 libsystem_pthread.dylib 0x1f19fda60 _pthread_start + 148
10 libsystem_pthread.dylib 0x1f19fcf5c thread_start + 8
Thread 6:
0 libsystem_pthread.dylib 0x1f19fcf48 start_wqthread + 0
Thread 7:
0 libsystem_pthread.dylib 0x1f19fcf48 start_wqthread + 0
Thread 8 name: com.google.firebase.crashlytics.MachExceptionServer
Thread 8:
0 libsystem_kernel.dylib 0x1b800bf78 write + 8
1 Development 0x10333156c FIRCLSSDKFileLog + 7705964 (FIRCLSInternalLogging.c:63)
2 Development 0x10332cbc8 FIRCLSMachExceptionReply + 7687112 (FIRCLSMachException.c:267)
3 Development 0x10332c6cc FIRCLSMachExceptionServer + 7685836 (FIRCLSMachException.c:178)
4 libsystem_pthread.dylib 0x1f19fda60 _pthread_start + 148
5 libsystem_pthread.dylib 0x1f19fcf5c thread_start + 8
Thread 9:
0 libsystem_pthread.dylib 0x1f19fcf48 start_wqthread + 0
Thread 10 name: com.apple.NSURLConnectionLoader
Thread 10:
0 libsystem_kernel.dylib 0x1b800a564 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b800abfc mach_msg + 76
2 CoreFoundation 0x18152e698 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x18153298c __CFRunLoopRun + 1212
4 CoreFoundation 0x1815463c8 CFRunLoopRunSpecific + 600
5 CFNetwork 0x181fb78d0 0x181d3d000 + 2599120
6 Foundation 0x182db995c __NSThread__start__ + 792
7 libsystem_pthread.dylib 0x1f19fda60 _pthread_start + 148
8 libsystem_pthread.dylib 0x1f19fcf5c thread_start + 8
Thread 11:
0 libsystem_kernel.dylib 0x1b800a564 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b800abfc mach_msg + 76
2 CoreFoundation 0x18152e698 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x18153298c __CFRunLoopRun + 1212
4 CoreFoundation 0x1815463c8 CFRunLoopRunSpecific + 600
5 Foundation 0x182d69d54 -[NSRunLoop+ 101716 (NSRunLoop) runMode:beforeDate:] + 236
6 Foundation 0x182d6a510 -[NSRunLoop+ 103696 (NSRunLoop) run] + 92
7 SwiftUI 0x189014f84 static DisplayLink.asyncThread+ 778116 (arg:) + 836
8 SwiftUI 0x189012b70 #objc static DisplayLink.asyncThread+ 768880 (arg:) + 100
9 Foundation 0x182db995c __NSThread__start__ + 792
10 libsystem_pthread.dylib 0x1f19fda60 _pthread_start + 148
11 libsystem_pthread.dylib 0x1f19fcf5c thread_start + 8
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000280b49780 x1: 0x0000000280b49780 x2: 0x0000000000000001 x3: 0x00000001930ae4f4
x4: 0x00000000000002e0 x5: 0x00000001063ba020 x6: 0x000000000000005e x7: 0x0000000000000005
x8: 0x00000000ffffffff x9: 0x0000000281e6eb80 x10: 0x0000000000000003 x11: 0x0000000200000003
x12: 0x0000000000000003 x13: 0x000000003a204827 x14: 0x000000003a405000 x15: 0x0000000000005000
x16: 0x000000003a400000 x17: 0x0000000000000f08 x18: 0x0000000114a31600 x19: 0x0000000000000007
x20: 0x0000000280b49780 x21: 0x0000000106219aa8 x22: 0x00000001894fa77c x23: 0x0000000000000002
x24: 0x00000001db34e000 x25: 0x00000001db9758d8 x26: 0x00000001db34e000 x27: 0x0000000106219a50
x28: 0x0000000281e6c140 fp: 0x000000016d223790 lr: 0x00000001894f9ea4
sp: 0x000000016d223780 pc: 0x000000018923f698 cpsr: 0x80000000
far: 0x000000011c084000 esr: 0xf2000001 (Breakpoint) brk 1
Binary Images:
0x188f57000 - 0x189f77fff SwiftUI arm64e <6d99bb3b20803dbbaecf604b49eb822d> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
0x1839d1000 - 0x185253fff UIKitCore arm64e <0e2d8679d5f13c0390107f6ce3662789> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x185279000 - 0x18555cfff QuartzCore arm64e <8ab30eebfb1536cb9c27918ed68500ee> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x181527000 - 0x18197afff CoreFoundation arm64e <6174789ae88c3f5cba39de2e9edc0750> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x19cd56000 - 0x19cd5efff GraphicsServices arm64e <0f7424f6bde5311aa3fac0e0c4c28d72> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x102bd8000 - 0x103983fff Development arm64 <d40c6dc01ef5385687bfe7476ba7240f> /private/var/containers/Bundle/Application/4F3744A5-3BEF-472F-8674-AF6F0414AE5F/Development.app/Development
0x1060d4000 - 0x10612bfff dyld arm64e <d48c31ee061f370ba6f78391a1b53ed8> /usr/lib/dyld
0x1f19fc000 - 0x1f1a07fff libsystem_pthread.dylib arm64e <bc1ce0c6a9f2396b9afb623d3acd5881> /usr/lib/system/libsystem_pthread.dylib
0x1b8009000 - 0x1b803cfff libsystem_kernel.dylib arm64e <d2476f74d204348d8d386165d0485c7c> /usr/lib/system/libsystem_kernel.dylib
0x182d51000 - 0x183055fff Foundation arm64e <efbca2ff8b8c3227abbc154ba851d23c> /System/Library/Frameworks/Foundation.framework/Foundation
0x181d3d000 - 0x182201fff CFNetwork arm64e <570aad29ce5c3cd9ab01ad21e1440ddb> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
EOF
Let me know if there is anymore info i can provide to help solve this problem.
I have a c++ program written in Qt5 5.14.1.
It also use privoxy source code inside.
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff6b8e17fa __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff6b99ebc1 pthread_kill + 432
2 libsystem_c.dylib 0x00007fff6b868ab6 __abort + 139
3 libsystem_c.dylib 0x00007fff6b868a2b abort + 135
4 org.qt-project.QtCore 0x000000010b807de9 qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) + 9
5 org.qt-project.QtCore 0x000000010b809534 QMessageLogger::fatal(char const*, ...) const + 202
6 org.qt-project.QtCore 0x000000010b81060d QThread::~QThread() + 189
7 com.yourcompany.xxxxxxxx 0x00000001099cc935 PrivoxyThread::~PrivoxyThread() + 21 (privoxythread.cpp:17)
8 com.yourcompany.xxxxxxxx 0x00000001099cc955 PrivoxyThread::~PrivoxyThread() + 21 (privoxythread.cpp:17)
9 com.yourcompany.xxxxxxxx 0x00000001099cc979 PrivoxyThread::~PrivoxyThread() + 25 (privoxythread.cpp:15)
10 org.qt-project.QtCore 0x000000010ba0f394 QObjectPrivate::deleteChildren() + 228
11 org.qt-project.QtCore 0x000000010ba0f128 QObject::~QObject() + 2088
12 com.yourcompany.xxxxxxxx 0x00000001099e4598 Connection::~Connection() + 88 (connection.cpp:38)
13 com.yourcompany.xxxxxxxx 0x00000001099e4695 Connection::~Connection() + 21 (connection.cpp:38)
14 com.yourcompany.xxxxxxxx 0x00000001099e4819 Connection::~Connection() + 25 (connection.cpp:36)
15 org.qt-project.QtCore 0x000000010ba0f394 QObjectPrivate::deleteChildren() + 228
16 org.qt-project.QtCore 0x000000010ba0f128 QObject::~QObject() + 2088
17 com.yourcompany.xxxxxxxx 0x0000000109b9bd75 ConnectionItem::~ConnectionItem() + 21 (connectionitem.h:26)
18 com.yourcompany.xxxxxxxx 0x0000000109b9a0c5 ConnectionItem::~ConnectionItem() + 21 (connectionitem.h:26)
19 com.yourcompany.xxxxxxxx 0x0000000109b9a0e9 ConnectionItem::~ConnectionItem() + 25 (connectionitem.h:26)
20 org.qt-project.QtCore 0x000000010ba0f394 QObjectPrivate::deleteChildren() + 228
21 org.qt-project.QtCore 0x000000010ba0f128 QObject::~QObject() + 2088
22 com.yourcompany.xxxxxxxx 0x00000001099efe1d ConnectionTableModel::~ConnectionTableModel() + 61 (connectiontablemodel.cpp:8)
23 com.yourcompany.xxxxxxxx 0x00000001099efe65 ConnectionTableModel::~ConnectionTableModel() + 21 (connectiontablemodel.cpp:8)
24 com.yourcompany.xxxxxxxx 0x00000001099efe89 ConnectionTableModel::~ConnectionTableModel() + 25 (connectiontablemodel.cpp:8)
25 org.qt-project.QtCore 0x000000010ba0f394 QObjectPrivate::deleteChildren() + 228
26 org.qt-project.QtWidgets 0x000000010a9f7dae QWidget::~QWidget() + 1006
27 com.yourcompany.xxxxxxxx 0x0000000109a0c789 MainWindow::~MainWindow() + 409 (mainwindow.cpp:166)
28 com.yourcompany.xxxxxxxx 0x0000000109a0c825 MainWindow::~MainWindow() + 21 (mainwindow.cpp:166)
29 com.yourcompany.xxxxxxxx 0x00000001099fefcb main + 1339 (main.cpp:98)
30 libdyld.dylib 0x00007fff6b79a7fd start + 1
Each time I click quit, or Command + Q. It will quit and crash.
Is there a way to determine what cause the issue?
Apple Will pop a window when application crash, this is very annoying.
I have an app thats released to few users in testflight and there's been report of various crashes and most of them points to below crash log. I've not been able to reproduce the crash, so, I'm trying to identify where it could possibly cause crash through crash logs. Below is the crash log and the method where it points the crash.
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001001c8e9c
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 My App 0x00000001001c8e9c specialized MyTableViewController.didUpdateText(MyTableViewCell, withText : String) -> () + 1008 (MyTableViewController.swift:0)
1 My App 0x00000001001c11b4 #objc MyTableViewController.didUpdateText(MyTableViewCell, withText : String) -> () + 92 (MyTableViewController.swift:0)
2 My App 0x00000001001c1234 protocol witness for MyTableViewCellDelegate.didUpdateText(MyTableViewCell, withText : String) -> () in conformance MyTableViewController + 92 (MyTableViewController.swift:0)
3 My App 0x00000001001f0550 specialized MyTableViewCell.textViewDidEndEditing(UITextView) -> () + 380 (MyTableViewCell.swift:225)
4 My App 0x00000001001ef0cc #objc MyTableViewCell.textViewDidChange(UITextView) -> () + 52
5 UIKit 0x00000001924a7ca0 -[UITextView resignFirstResponder] + 252 (UITextView.m:2151)
6 UIKit 0x00000001924dc39c -[UITableView reloadData] + 328 (UITableView.m:5116)
7 My App 0x00000001001bdcec MyTableViewController.loadDetailsView() -> () + 1040 (MyTableViewController.swift:220)
8 My App 0x000000010017a4b0 MainViewController.loadDetailsView() -> () + 132 (MainViewController.swift:234)
9 My App 0x000000010017a54c #objc MainViewController.loadDetailsView() -> () + 28 (MainViewController.swift:0)
10 My App 0x00000001000edcbc __58-[DisplayViewController createNewInstanceForUser]_block_invoke + 120 (DisplayViewController.m:1221)
11 libdispatch.dylib 0x000000018b18a9e0 _dispatch_call_block_and_release + 24 (init.c:963)
12 libdispatch.dylib 0x000000018b18a9a0 _dispatch_client_callout + 16 (object.m:473)
13 libdispatch.dylib 0x000000018b18f5e8 _dispatch_main_queue_callback_4CF + 996 (inline_internal.h:2431)
14 CoreFoundation 0x000000018c2810c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1793)
15 CoreFoundation 0x000000018c27ece4 __CFRunLoopRun + 1572 (CFRunLoop.c:3004)
16 CoreFoundation 0x000000018c1aeda4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
17 GraphicsServices 0x000000018dc19074 GSEventRunModal + 100 (GSEvent.c:2245)
18 UIKit 0x0000000192462c9c UIApplicationMain + 208 (UIApplication.m:4089)
19 My App 0x000000010013f978 main + 92 (main.m:14)
20 libdyld.dylib 0x000000018b1bd59c start + 4
Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x000000018b2af224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018b2af09c mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000018c280e90 __CFRunLoopServiceMachPort + 192 (CFRunLoop.c:2527)
3 CoreFoundation 0x000000018c27eae4 __CFRunLoopRun + 1060 (CFRunLoop.c:2870)
4 CoreFoundation 0x000000018c1aeda4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
5 Foundation 0x000000018ccc9db4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 (NSRunLoop.m:367)
6 Foundation 0x000000018cceab84 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96 (NSRunLoop.m:411)
7 UIKit 0x0000000192dec830 -[UIEventFetcher threadMain] + 136 (UIEventFetcher.m:313)
8 Foundation 0x000000018cdc7318 __NSThread__start__ + 996 (NSThread.m:1163)
9 libsystem_pthread.dylib 0x000000018b39568c _pthread_body + 240 (pthread.c:697)
10 libsystem_pthread.dylib 0x000000018b39559c _pthread_start + 284 (pthread.c:744)
11 libsystem_pthread.dylib 0x000000018b392cb4 thread_start + 4
Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x000000018b2af224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018b2af09c mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000018c280e90 __CFRunLoopServiceMachPort + 192 (CFRunLoop.c:2527)
3 CoreFoundation 0x000000018c27eae4 __CFRunLoopRun + 1060 (CFRunLoop.c:2870)
4 CoreFoundation 0x000000018c1aeda4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
5 CFNetwork 0x000000018c9bbdf4 +[NSURLConnection(Loader) _resourceLoadLoop:] + 404 (NSURLConnection.mm:364)
6 Foundation 0x000000018cdc7318 __NSThread__start__ + 996 (NSThread.m:1163)
7 libsystem_pthread.dylib 0x000000018b39568c _pthread_body + 240 (pthread.c:697)
8 libsystem_pthread.dylib 0x000000018b39559c _pthread_start + 284 (pthread.c:744)
9 libsystem_pthread.dylib 0x000000018b392cb4 thread_start + 4
Thread 3:
0 libsystem_kernel.dylib 0x000000018b2cce1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x000000018b394814 _pthread_cond_wait + 640 (pthread_cond.c:536)
2 libc++.1.dylib 0x000000018acbdac8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 56 (condition_variable.cpp:44)
3 JavaScriptCore 0x0000000190b5bf08 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 112 (condition_variable:202)
4 JavaScriptCore 0x0000000190b5be7c bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 168 (condition_variable:211)
5 JavaScriptCore 0x0000000190b5bd5c bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadEntryPoint(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*) + 36 (AsyncTask.h:110)
6 JavaScriptCore 0x0000000190b5c00c void* std::__1::__thread_proxy<std::__1::tuple<void (*)(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*> >(void*) + 92 (__functional_base:416)
7 libsystem_pthread.dylib 0x000000018b39568c _pthread_body + 240 (pthread.c:697)
8 libsystem_pthread.dylib 0x000000018b39559c _pthread_start + 284 (pthread.c:744)
9 libsystem_pthread.dylib 0x000000018b392cb4 thread_start + 4
Thread 4 name:
Thread 4:
0 libsystem_kernel.dylib 0x000000018b2af224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018b2af09c mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000018c280e90 __CFRunLoopServiceMachPort + 192 (CFRunLoop.c:2527)
3 CoreFoundation 0x000000018c27eae4 __CFRunLoopRun + 1060 (CFRunLoop.c:2870)
4 CoreFoundation 0x000000018c1aeda4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
5 WebCore 0x0000000190e79d3c RunWebThread(void*) + 456 (WebCoreThread.mm:694)
6 libsystem_pthread.dylib 0x000000018b39568c _pthread_body + 240 (pthread.c:697)
7 libsystem_pthread.dylib 0x000000018b39559c _pthread_start + 284 (pthread.c:744)
8 libsystem_pthread.dylib 0x000000018b392cb4 thread_start + 4
Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x000000018b2cce1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x000000018b394814 _pthread_cond_wait + 640 (pthread_cond.c:536)
2 JavaScriptCore 0x00000001901af9a4 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 80 (ThreadingPthreads.cpp:359)
3 JavaScriptCore 0x0000000190b42a68 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 2256 (ParkingLot.cpp:597)
4 JavaScriptCore 0x00000001907baf58 JSC::Heap::stopTheMutator() + 272 (ParkingLot.h:81)
5 JavaScriptCore 0x00000001907b89a0 JSC::Heap::stopTheWorld() + 160 (Heap.cpp:1219)
6 JavaScriptCore 0x00000001907ba230 JSC::Heap::collectInThread() + 192 (Heap.cpp:1118)
7 JavaScriptCore 0x00000001907bcd50 JSC::Heap::Thread::work() + 16 (Heap.cpp:229)
8 JavaScriptCore 0x0000000190b327f4 std::__1::__function::__func<WTF::AutomaticThread::start(WTF::Locker<WTF::LockBase> const&)::$_0, std::__1::allocator<WTF::AutomaticThread::start(WTF::Locker<WTF::LockBase> const&)::$_0>, void ()>::operator()() + 352 (AutomaticThread.cpp:215)
9 JavaScriptCore 0x00000001901abf7c WTF::threadEntryPoint(void*) + 212 (functional:1817)
10 JavaScriptCore 0x00000001901abe8c WTF::wtfThreadEntryPoint(void*) + 24 (ThreadingPthreads.cpp:164)
11 libsystem_pthread.dylib 0x000000018b39568c _pthread_body + 240 (pthread.c:697)
12 libsystem_pthread.dylib 0x000000018b39559c _pthread_start + 284 (pthread.c:744)
13 libsystem_pthread.dylib 0x000000018b392cb4 thread_start + 4
Thread 6:
0 libsystem_pthread.dylib 0x000000018b392ca8 start_wqthread + 0 (pthread.c:2333)
Thread 7:
0 libsystem_pthread.dylib 0x000000018b392ca8 start_wqthread + 0 (pthread.c:2333)
Thread 8:
0 libsystem_pthread.dylib 0x000000018b392ca8 start_wqthread + 0 (pthread.c:2333)
Thread 9:
0 libsystem_pthread.dylib 0x000000018b392ca8 start_wqthread + 0 (pthread.c:2333)
Thread 10:
0 libsystem_kernel.dylib 0x000000018b2cda88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000018b3931a4 _pthread_wqthread + 1260 (pthread.c:2205)
2 libsystem_pthread.dylib 0x000000018b392cac start_wqthread + 4
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x000000000000000c x1: 0x0000000176054d00 x2: 0x0000000000000008 x3: 0x000000018b3132c0
x4: 0x000000016fd72317 x5: 0x0000000000000000 x6: 0x0000000000000001 x7: 0x0000000000000000
x8: 0x000000000000000b x9: 0x0000000000000004 x10: 0x0000000000000000 x11: 0xbaddc0dedeadbead
x12: 0x0000000174c73fb0 x13: 0x0000000000000010 x14: 0x0000000000000008 x15: 0x0000000000000010
x16: 0x00000001010411f0 x17: 0x000000018ad530dc x18: 0x0000000000000000 x19: 0x0000000176054d00
x20: 0x0000000101340560 x21: 0x000000017644f810 x22: 0x0000000000000000 x23: 0x00000001001bb5cc
x24: 0x000000012a61f840 x25: 0x000000017569d150 x26: 0x0000000174243fa8 x27: 0x00000001003f5b30
x28: 0x0000000100d31660 fp: 0x000000016fd726c0 lr: 0x00000001001c8c4c
sp: 0x000000016fd72640 pc: 0x00000001001c8e9c cpsr: 0x20000000
Crash log in XCode points to this function
func textViewDidEndEditing(_ textView: UITextView) {
selectButton.isSelected = false
selectButtonAction(true)
delegate?.didUpdateText(self, withText: textView.text) //Crash points to this line
}
Since the delegate is optional I believe it shouldn't crash on this line, so if I put a nil check for delegate here I don't think it will do any good. Is there anyway to identify what could be causing the crash from this log?
I knew EXC_BAD_ACCESS & Zombie, and how to find it in normal way. But what I face now is very very confusing, at least to me.
Background
I have a multi-account app, in which the user can login many accounts at the same time.
The app works well with only one account on, but when the user really logins more and more accounts, the app becomes more and more vulnerable as well, crashing randomly but mostly on AppLaunch. Not 8badf00d, but EXC_BAD_ACCESS (SIGSEGV) / KERN_INVALID_ADDRESS.
Code Architecture
Objective-C - Application level, including UI.
|
Objective-C & C++ - Account Context, including login logic.
|
C++ - Net/Communication level, including sockets.
Notification & Delegation are both used between levels.
Reproduce
Double-tap the Home button, swipe the app out to kill it, then tap the app icon to relaunch it. After passing TouchId, the app will login the accounts, and randomly crash, resulting in many different crash logs. No matter the device is iPhone 6s plus or iPhone 5s/5c/5, iOS 8 or iOS 9.
The memory usage is not high, just several tens of MB.
Crash Log No.1
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000100000048
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000180b8dbd0 objc_msgSend + 16
1 CoreFoundation 0x00000001814c7fe0 -[_CFXNotificationObjectRegistration match:matching:] + 152
2 CoreFoundation 0x0000000181573704 -[_CFXNotificationNameRegistration match:observer:matching:] + 372
3 CoreFoundation 0x0000000181518778 -[_CFXNotificationRegistrar match:object:observer:enumerator:] + 1968
4 CoreFoundation 0x0000000181415894 _CFXNotificationRemoveObservers + 164
5 Foundation 0x0000000181de3510 -[NSNotificationCenter removeObserver:name:object:] + 236
6 Foundation 0x0000000181df036c -[__NSObserver dealloc] + 48
7 UIKit 0x000000018639d12c -[_UIBackdropView dealloc] + 280
8 libobjc.A.dylib 0x0000000180b95ae8 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 508
9 CoreFoundation 0x00000001813f142c _CFAutoreleasePoolPop + 28
10 UIKit 0x00000001864bdf94 _prepareForCAFlush + 352
11 UIKit 0x00000001861fe8f4 _UIApplicationHandleEventQueue + 5880
12 CoreFoundation 0x00000001814c4efc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
13 CoreFoundation 0x00000001814c4910 __CFRunLoopDoSources0 + 412
14 CoreFoundation 0x00000001814c2690 __CFRunLoopRun + 724
15 CoreFoundation 0x00000001813f1680 CFRunLoopRunSpecific + 384
16 GraphicsServices 0x0000000182900088 GSEventRunModal + 180
17 UIKit 0x0000000186268d90 UIApplicationMain + 204
18 MultiAccountApp 0x0000000100095254 main (main.m:19)
19 libdyld.dylib 0x0000000180f928b8 start + 4
Thread 1:
0 libsystem_pthread.dylib 0x000000018117501c start_wqthread + 0
Thread 2 name: Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0 libsystem_kernel.dylib 0x00000001810b14fc kevent_qos + 8
1 libdispatch.dylib 0x0000000180f7494c _dispatch_mgr_invoke + 232
2 libdispatch.dylib 0x0000000180f637bc _dispatch_source_invoke + 0
Crash Log No.2
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000180b7e5f4 _class_getNonMetaClass + 212
1 libobjc.A.dylib 0x0000000180b7e5f0 _class_getNonMetaClass + 208
2 libobjc.A.dylib 0x0000000180b7accc _class_resolveMethod + 112
3 libobjc.A.dylib 0x0000000180b839a8 lookUpImpOrForward + 360
4 libobjc.A.dylib 0x0000000180b837b4 class_getInstanceMethod + 64
5 Foundation 0x0000000181e1530c +[NSObject(NSKeyValueObservingCustomization) keyPathsForValuesAffectingValueForKey:] + 236
6 Foundation 0x0000000181e14ff8 -[NSKeyValueUnnestedProperty _givenPropertiesBeingInitialized:getAffectingProperties:] + 184
7 Foundation 0x0000000181e14d14 -[NSKeyValueUnnestedProperty _initWithContainerClass:key:propertiesBeingInitialized:] + 152
8 Foundation 0x0000000181e14bec NSKeyValuePropertyForIsaAndKeyPathInner + 284
9 Foundation 0x0000000181e11508 NSKeyValuePropertyForIsaAndKeyPath + 152
10 Foundation 0x0000000181e27ddc _NSKeyValueCreateImplicitObservationInfo + 248
11 CoreData 0x0000000182fa1764 -[NSManagedObjectContext(_NSInternalNotificationHandling) _implicitObservationInfoForEntity:forResultingClass:] + 300
12 CoreData 0x0000000182fa162c -[NSManagedObject(_NSInternalMethods) _implicitObservationInfo] + 96
13 Foundation 0x0000000181de2840 -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 160
14 CoreData 0x0000000183002c2c -[NSManagedObject(_NSInternalMethods) _updateFromRefreshSnapshot:includingTransients:] + 628
15 CoreData 0x0000000183015b54 -[NSManagedObjectContext(_NestedContextSupport) _copyChildObject:toParentObject:fromChildContext:] + 924
16 CoreData 0x0000000183015f70 -[NSManagedObjectContext(_NestedContextSupport) _parentProcessSaveRequest:inContext:error:] + 996
17 CoreData 0x0000000183016a44 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 348
18 CoreData 0x0000000183018d80 internalBlockToNSManagedObjectContextPerform + 108
19 libdispatch.dylib 0x0000000180f615f0 _dispatch_client_callout + 16
20 libdispatch.dylib 0x0000000180f70c5c _dispatch_barrier_sync_f_slow_invoke + 644
21 libdispatch.dylib 0x0000000180f615f0 _dispatch_client_callout + 16
22 libdispatch.dylib 0x0000000180f66cf8 _dispatch_main_queue_callback_4CF + 1844
23 CoreFoundation 0x00000001814c4bb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
24 CoreFoundation 0x00000001814c2a18 __CFRunLoopRun + 1628
25 CoreFoundation 0x00000001813f1680 CFRunLoopRunSpecific + 384
26 GraphicsServices 0x0000000182900088 GSEventRunModal + 180
27 UIKit 0x0000000186268d90 UIApplicationMain + 204
28 MultiAccountApp 0x0000000100085254 main (main.m:19)
29 libdyld.dylib 0x0000000180f928b8 start + 4
Thread 1:
0 libsystem_kernel.dylib 0x00000001810b0b6c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000181175530 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000181175020 start_wqthread + 4
Thread 2 name: Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0 libsystem_kernel.dylib 0x00000001810b14fc kevent_qos + 8
1 libdispatch.dylib 0x0000000180f7494c _dispatch_mgr_invoke + 232
2 libdispatch.dylib 0x0000000180f637bc _dispatch_source_invoke + 0
Crash Log No.3
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000100000038
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000180b8dbd0 objc_msgSend + 16
1 QuartzCore 0x0000000183c3bad0 CA::Render::String::new_string(__CFString const*) + 36
2 QuartzCore 0x0000000183c3c46c -[CABackdropLayer _copyRenderLayer:layerFlags:commitFlags:] + 144
3 QuartzCore 0x0000000183c0ac54 CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 108
4 QuartzCore 0x0000000183c079cc CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 392
5 QuartzCore 0x0000000183c0795c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
6 QuartzCore 0x0000000183c0795c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
7 QuartzCore 0x0000000183c0795c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
8 QuartzCore 0x0000000183c0795c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
9 QuartzCore 0x0000000183c07750 x_hash_table_foreach + 72
10 QuartzCore 0x0000000183c06cc8 CA::Transaction::foreach_root(void (*)(CA::Layer*, void*), void*) + 40
11 QuartzCore 0x0000000183c050f0 CA::Context::commit_transaction(CA::Transaction*) + 1368
12 QuartzCore 0x0000000183c049dc CA::Transaction::commit() + 512
13 UIKit 0x00000001864bde20 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke_2 + 104
14 CoreFoundation 0x00000001814c4de4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
15 CoreFoundation 0x00000001814c471c __CFRunLoopDoBlocks + 308
16 CoreFoundation 0x00000001814c26a4 __CFRunLoopRun + 744
17 CoreFoundation 0x00000001813f1680 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x0000000182900088 GSEventRunModal + 180
19 UIKit 0x0000000186268d90 UIApplicationMain + 204
20 MultiAccountApp 0x000000010009d254 main (main.m:19)
21 libdyld.dylib 0x0000000180f928b8 start + 4
Crash Log No.4
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000100000048
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000180b8dbd0 objc_msgSend + 16
1 CoreFoundation 0x00000001813f93e0 -[__NSArrayM dealloc] + 152
2 libobjc.A.dylib 0x0000000180b95ae8 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 508
3 CoreFoundation 0x00000001813f142c _CFAutoreleasePoolPop + 28
4 CoreFoundation 0x00000001814c2a20 __CFRunLoopRun + 1636
5 CoreFoundation 0x00000001813f1680 CFRunLoopRunSpecific + 384
6 GraphicsServices 0x0000000182900088 GSEventRunModal + 180
7 UIKit 0x0000000186268d90 UIApplicationMain + 204
8 MultiAccountApp 0x00000001000f5254 main (main.m:19)
9 libdyld.dylib 0x0000000180f928b8 start + 4
Thread 1:
0 libsystem_kernel.dylib 0x00000001810b0b6c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000181175530 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000181175020 start_wqthread + 4
Crash Log No.5
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000100000050
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000180b8dbd0 objc_msgSend + 16
1 CoreFoundation 0x00000001814c7fe0 -[_CFXNotificationObjectRegistration match:matching:] + 152
2 CoreFoundation 0x0000000181573704 -[_CFXNotificationNameRegistration match:observer:matching:] + 372
3 CoreFoundation 0x0000000181518778 -[_CFXNotificationRegistrar match:object:observer:enumerator:] + 1968
4 CoreFoundation 0x0000000181415894 _CFXNotificationRemoveObservers + 164
5 Foundation 0x0000000181de3510 -[NSNotificationCenter removeObserver:name:object:] + 236
6 UIKit 0x00000001863a0948 -[UINavigationController dealloc] + 140
7 CoreFoundation 0x00000001813f5380 -[__NSArrayI dealloc] + 80
8 UIKit 0x00000001864b0cb4 _runAfterCACommitDeferredBlocks + 616
9 UIKit 0x00000001864be030 _cleanUpAfterCAFlushAndRunDeferredBlocks + 92
10 CoreFoundation 0x00000001814c4de4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
11 CoreFoundation 0x00000001814c471c __CFRunLoopDoBlocks + 308
12 CoreFoundation 0x00000001814c26a4 __CFRunLoopRun + 744
13 CoreFoundation 0x00000001813f1680 CFRunLoopRunSpecific + 384
14 GraphicsServices 0x0000000182900088 GSEventRunModal + 180
15 UIKit 0x0000000186268d90 UIApplicationMain + 204
16 MultiAccountApp 0x0000000100099254 main (main.m:19)
17 libdyld.dylib 0x0000000180f928b8 start + 4
Though I have logs in hand, I still have no idea how to solve it. Maybe the Address Space has been dirty? Forcibly / unintentionally modified by the C++ level?
Thanks in advance.
So I've written the following Qt slot definition:
(header)
public slots:
void test1();
(method)
void myClass:test1()
{
//...
}
If I put some code in my slot definition, such as code to display a new window or a new messagebox, the code executes fine. However, if I stick in my own function, such as the following:
QString myClass::run_func(QString phase)
{
myOtherClass* moc = new myOtherClass();
moc->run(phase);
}
void myClass:test1()
{
run_func("hello world");
}
My program crashes, with the following message:
Sleep/Wake UUID: 03C9AE1C-32F3-4F2E-8396-80655C0AE1EA
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000010a08062020
VM Regions Near 0x10a08062020:
CG shared images 00000001c7eb2000-00000001c7eba000 [ 32K] r--/r-- SM=SHM
-->
STACK GUARD 00007fff5bc00000-00007fff5f400000 [ 56.0M] ---/rwx SM=NUL stack guard for thread 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 QtCore 0x0000000100d0c344 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 52
1 QtWidgets 0x0000000100040f19 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 281
2 QtWidgets 0x00000001000427b2 QApplication::notify(QObject*, QEvent*) + 1442
3 QtCore 0x0000000100d0c0b2 QCoreApplication::notifyInternal(QObject*, QEvent*) + 114
4 QtWidgets 0x0000000100096344 QWidgetWindow::event(QEvent*) + 212
5 QtWidgets 0x0000000100040f2c QApplicationPrivate::notify_helper(QObject*, QEvent*) + 300
6 QtWidgets 0x0000000100043a1d QApplication::notify(QObject*, QEvent*) + 6157
7 QtCore 0x0000000100d0c0b2 QCoreApplication::notifyInternal(QObject*, QEvent*) + 114
8 QtGui 0x000000010068c9be QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) + 190
9 QtGui 0x000000010068b5c8 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) + 840
10 QtGui 0x000000010067b338 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 136
11 libqcocoa.dylib 0x000000010441a4c7 QCocoaEventDispatcherPrivate::processPostedEvents() + 295
12 libqcocoa.dylib 0x000000010441afd8 QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) + 40
13 com.apple.CoreFoundation 0x00007fff89c72731 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 com.apple.CoreFoundation 0x00007fff89c63ea2 __CFRunLoopDoSources0 + 242
15 com.apple.CoreFoundation 0x00007fff89c6362f __CFRunLoopRun + 831
16 com.apple.CoreFoundation 0x00007fff89c630b5 CFRunLoopRunSpecific + 309
17 com.apple.HIToolbox 0x00007fff874eea0d RunCurrentEventLoopInMode + 226
18 com.apple.HIToolbox 0x00007fff874ee685 ReceiveNextEventCommon + 173
19 com.apple.HIToolbox 0x00007fff874ee5bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
20 com.apple.AppKit 0x00007fff8e83a3de _DPSNextEvent + 1434
21 com.apple.AppKit 0x00007fff8e839a2b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
22 com.apple.AppKit 0x00007fff8e82db2c -[NSApplication run] + 553
23 libqcocoa.dylib 0x0000000104419d44 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2404
24 QtCore 0x0000000100d0964d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 397
25 QtCore 0x0000000100d0c652 QCoreApplication::exec() + 354
26 com.yourcompany.PwrCard 0x0000000100002f8b main + 91 (main.cpp:10)
27 com.yourcompany.PwrCard 0x0000000100002f24 start + 52
Thread 1:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8c4ca662 kevent64 + 10
1 libdispatch.dylib 0x00007fff872d243d _dispatch_mgr_invoke + 239
2 libdispatch.dylib 0x00007fff872d2152 _dispatch_mgr_thread + 52
Thread 3:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 5:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 6:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 7:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 8:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 9:
0 libsystem_kernel.dylib 0x00007fff8c4c9e6a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff900a8f08 _pthread_wqthread + 330
2 libsystem_pthread.dylib 0x00007fff900abfb9 start_wqthread + 13
Thread 10:
0 libsystem_kernel.dylib 0x00007fff8c4c5a1a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff8c4c4d18 mach_msg + 64
2 com.apple.CoreFoundation 0x00007fff89c64155 __CFRunLoopServiceMachPort + 181
3 com.apple.CoreFoundation 0x00007fff89c63779 __CFRunLoopRun + 1161
4 com.apple.CoreFoundation 0x00007fff89c630b5 CFRunLoopRunSpecific + 309
5 com.apple.AppKit 0x00007fff8e9da16e _NSEventThread + 144
6 libsystem_pthread.dylib 0x00007fff900a7899 _pthread_body + 138
7 libsystem_pthread.dylib 0x00007fff900a772a _pthread_start + 137
8 libsystem_pthread.dylib 0x00007fff900abfc9 thread_start + 13
I have my slot linked up with the returnPressed() signal of a lineEdit. I can't figure out for the life of me why this only happens for user-defined functions. Any help would be greatly appreciated. Thanks guys!
Solved it.. run_func has a string return type but didn't actually return a string. Didn't catch this because there wasn't a compile error.