运行cpp文件时由于未捕获的异常而终止应用程序

时间:2018-12-24 17:16:14

标签: macos qt macos-mojave

我试图使用vtk在Qt创建器上可视化pcd(点云数据类型)数据文件。但是它弹出了一些奇怪的错误。输出如下:

2018-12-25 01:06:59.667 test6[10199:1376847] *** Terminating app due                to uncaught exception 'NSInternalInconsistencyException', reason:    'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff4dadbecd     __exceptionPreprocess + 256
    1   libobjc.A.dylib                     0x00007fff79b97720 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff4daf595d -[NSException raise] + 9
    3   AppKit                              0x00007fff4aff6c8e -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 324
    4   AppKit                              0x00007fff4aff407c -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1488
    5   AppKit                              0x00007fff4aff3aa6 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
    6   libvtkRenderingOpenGL2-8.1.1.dylib  0x000000010b7bbbae _ZN20vtkCocoaRenderWindow13CreateAWindowEv + 2136
    7   libvtkRenderingOpenGL2-8.1.1.dylib  0x000000010b7bc1db _ZN20vtkCocoaRenderWindow10InitializeEv + 205
    8   libvtkRenderingOpenGL2-8.1.1.dylib  0x000000010b7b9cb0 _ZN20vtkCocoaRenderWindow5StartEv + 18
    9   libvtkRenderingOpenGL2-8.1.1.dylib  0x000000010b7b834c _ZN30vtkCocoaRenderWindowInteractor10InitializeEv + 56
    10  libpcl_visualization.1.9.dylib      0x000000010c1ec797 _ZN3pcl13visualization13PCLVisualizer16createInteractorEv + 213
    11  libpcl_visualization.1.9.dylib      0x000000010c1ec34e _ZN3pcl13visualization13PCLVisualizerC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb + 490
    12  libpcl_visualization.1.9.dylib      0x000000010c2100f3 _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 49
    13  libboost_thread-mt.dylib            0x000000010da602c8 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 136
    14  libsystem_pthread.dylib             0x00007fff7ae59305 _pthread_body + 126
    15  libsystem_pthread.dylib             0x00007fff7ae5c26f _pthread_start + 70
    16  libsystem_pthread.dylib             0x00007fff7ae58415     thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

对此有何想法? 我的电脑是Mojave 10.14.2

1 个答案:

答案 0 :(得分:2)

潜在的问题是所有AppKit / GUI调用都需要在主线程中进行,但是您的应用正在从非主线程中调用AppKit。我不确定这是您的代码还是您正在使用的一个库中的问题。