Ask Your Question

Revision history [back]

cv::viz::viz3d Crashes soon after Mouse Interaction OS X

I'm am trying to run a cv::viz thread outside of my main thread to visualize a stream of 3D points. cv::viz Window

Notice that missing are the typical 3 buttons for close, minimize, and expand. The main loop looks as follows:

  cv::viz::Viz3d vizWindow( "Coordinate Frame" );

  while( isActive() && !vizWindow.wasStopped() )
  {
    points3dFrame = m_points3dBuffer.waitNewFrame( lastTimepoint );
    lastTimepoint = points3dFrame->timepoint;

    std::vector<cv::Vec4f> cloud = filterCloudByDepth( points3dFrame );

    if( cloud.empty() ) { continue; }

    auto cloudWidget = cv::viz::WCloud( cloud, cv::viz::Color::green() );
    cloudWidget.setRenderingProperty( cv::viz::POINT_SIZE, 2 );

    vizWindow.showWidget( "Depth", cloudWidget );

    vizWindow.spinOnce( 30, true );
  }

This runs as desired when built with VS2012 and run on windows. However, when I try to run this built with Xcode 7.2 tool on OS X 10.11.4 it will crash soon after I try to interact with the window using my mouse, with warning logged to the console before crashing.

Any idea why this fails? Do I really need to put this in my main thread? Why is it ok not to do so on Windows?

Errors to console:

Viewer3d Start
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const: conn 0x244a7 token 0x34fffffffffd8c48
Apr 15 12:52:19  augen[8908] <Warning>: Backtrace (at 33554.3):
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  0   CoreGraphics                        0x00007fff9ca45a99 CGSDisableUpdateToken + 210
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  1   AppKit                              0x00007fff9b385524 ___disable_updates_sync_block_invoke_2 + 17
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  2   libdispatch.dylib                   0x00007fff8fcff40b _dispatch_client_callout + 8
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  3   libdispatch.dylib                   0x00007fff8fd009f2 _dispatch_barrier_sync_f_invoke + 74
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  4   AppKit                              0x00007fff9b3853f2 NSCGSDisableUpdates + 213
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  5   AppKit                              0x00007fff9b385228 NSCGSTransactionRunPreCommitActionsForOrder_ + 156
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  6   AppKit                              0x00007fff9b38516f NSCGSTransactionRunPreCommitActions_ + 21
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  7   AppKit                              0x00007fff9bb33d84 -[_NSCGSTransaction synchronize] + 33
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  8   AppKit                              0x00007fff9bb33ff9 NSCGSTransactionSynchronize + 76
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  9   AppKit                              0x00007fff9b91f065 -[NSSurface syncSurfaceWantsExtendedDynamicRange] + 150
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  10  AppKit                              0x00007fff9b4573d1 -[NSSurface _createSurface] + 677
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  11  AppKit                              0x00007fff9b456d2c -[NSSurface setFrame:] + 785
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  12  AppKit                              0x00007fff9b91f16b __38-[NSSurface syncToViewUnconditionally]_block_invoke + 154
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  13  AppKit                              0x00007fff9b374429 NSPerformVisuallyAtomicChange + 147
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  14  AppKit                              0x00007fff9b456650 -[NSSurface syncToViewUnconditionally] + 100
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  15  AppKit                              0x00007fff9b91f204 __37-[NSSurface orderSurface:relativeTo:]_block_invoke + 44
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  16  AppKit                              0x00007fff9b374429 NSPerformVisuallyAtomicChange + 147
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  17  AppKit                              0x00007fff9b456523 -[NSSurface orderSurface:relativeTo:] + 160
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  18  AppKit                              0x00007fff9b549f22 NSOpenGLContextAttachOnScreenViewSurface + 183
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  19  AppKit                              0x00007fff9b876767 __27-[NSOpenGLContext setView:]_block_invoke + 192
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  20  AppKit                              0x00007fff9b374429 NSPerformVisuallyAtomicChange + 147
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  21  AppKit                              0x00007fff9b536cd9 -[NSOpenGLContext setView:] + 119
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  22  libvtkRenderingOpenGL-6.3.1.dylib   0x0000000115056a65 _ZN20vtkCocoaRenderWindow13CreateAWindowEv + 1363
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  23  libvtkRenderingOpenGL-6.3.1.dylib   0x0000000115056f3c _ZN20vtkCocoaRenderWindow10InitializeEv + 212
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  24  libvtkRenderingOpenGL-6.3.1.dylib   0x0000000115054f5a _ZN20vtkCocoaRenderWindow5StartEv + 18
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  25  libvtkRenderingOpenGL-6.3.1.dylib   0x000000011505359a _ZN30vtkCocoaRenderWindowInteractor10InitializeEv + 56
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  26  libvtkRenderingCore-6.3.1.dylib     0x00000001155109f6 _ZN15vtkRenderWindow6RenderEv + 162
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  27  libopencv_viz.3.1.dylib             0x00000001070c2d45 _ZN2cv3viz5Viz3d7VizImpl8spinOnceEib + 247
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  28  augen                               0x000000010509a165 _ZN8Viewer3d3runEv + 8581
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  29  augen                               0x000000010508c5b1 _ZNSt3__114__thread_proxyINS_5tupleIJMN5augen6ThreadEFvvEPS3_EEEEEPvS8_ + 113
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  30  libsystem_pthread.dylib             0x00007fff9232799d _pthread_body + 131
Apr 15 12:52:19  augen[8908] <Warning>: void CGSUpdateManager::log() const:  31  libsystem_pthread.dylib             0x00007fff9232791a _pthread_body + 0