PointCloudLibrary / PointCloudLibrary/pcl

CloudViewer not supported on Mac

Open
#1,753 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

platform: macos
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

I've bumped against this one last year, but forgot to report it back then.

Your Environment

  • Operating System and version: Mac OSX 10.11.6
  • Compiler: LLVM Clang 3.8
  • PCL Version: master

Expected Behavior

Open an empty cloudviewer window.

Current Behavior

The rendering backend is complaining that some methods are not being called from the main thread.

Code to Reproduce

CMake

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(cloud_viewer)

find_package(PCL 1.5 REQUIRED)

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_executable (cloud_viewer cloud_viewer.cpp)
target_link_libraries (cloud_viewer ${PCL_LIBRARIES})

Snippet

#include <pcl/visualization/cloud_viewer.h>

int
main (int argc, char** argv)
{
  pcl::visualization::CloudViewer viewer ("Cluster viewer");
  while (!viewer.wasStopped ())
  {
    boost::this_thread::sleep (boost::posix_time::microseconds (100));
  }
  return (0);
}

Output

$ ./cloud_viewer 
2016-11-06 20:07:19.775 cloud_viewer[10114:307786] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-11-06 20:07:19.775 cloud_viewer[10114:307786] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-11-06 20:07:19.777 cloud_viewer[10114:307786] (
	0   CoreFoundation                      0x00007fff94c89452 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff8cb8773c objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff94c8e12a +[NSException raise:format:arguments:] + 106
	3   Foundation                          0x00007fff97602856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
	4   Foundation                          0x00007fff97587af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
	5   AppKit                              0x00007fff994d9e22 -[NSApplication run] + 844
	6   libpcl_visualization.1.8.dylib      0x000000011c54bb55 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 357
	7   libpcl_visualization.1.8.dylib      0x000000011c5de769 _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 3129
	8   libpcl_visualization.1.8.dylib      0x000000011c5dd1ec _ZN5boost6detail11thread_dataINS_17reference_wrapperIN3pcl13visualization11CloudViewer16CloudViewer_implEEEE3runEv + 28
	9   libboost_thread-mt.dylib            0x000000010fa66715 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 53
	10  libsystem_pthread.dylib             0x00007fff9b94399d _pthread_body + 131
	11  libsystem_pthread.dylib             0x00007fff9b94391a _pthread_body + 0
	12  libsystem_pthread.dylib             0x00007fff9b941351 thread_start + 13
)
2016-11-06 20:07:19.777 cloud_viewer[10114:307786] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] An uncaught exception was raised
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] (
	0   CoreFoundation                      0x00007fff94c89452 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff8cb8773c objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff94c8e12a +[NSException raise:format:arguments:] + 106
	3   Foundation                          0x00007fff97602856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
	4   Foundation                          0x00007fff97587af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
	5   AppKit                              0x00007fff994d9ebe -[NSApplication run] + 1000
	6   libpcl_visualization.1.8.dylib      0x000000011c54bb55 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 357
	7   libpcl_visualization.1.8.dylib      0x000000011c5de769 _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 3129
	8   libpcl_visualization.1.8.dylib      0x000000011c5dd1ec _ZN5boost6detail11thread_dataINS_17reference_wrapperIN3pcl13visualization11CloudViewer16CloudViewer_implEEEE3runEv + 28
	9   libboost_thread-mt.dylib            0x000000010fa66715 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 53
	10  libsystem_pthread.dylib             0x00007fff9b94399d _pthread_body + 131
	11  libsystem_pthread.dylib             0x00007fff9b94391a _pthread_body + 0
	12  libsystem_pthread.dylib             0x00007fff9b941351 thread_start + 13
)
2016-11-06 20:07:19.778 cloud_viewer[10114:307786] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff94c89452 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff8cb8773c objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff94c8e12a +[NSException raise:format:arguments:] + 106
	3   Foundation                          0x00007fff97602856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
	4   Foundation                          0x00007fff97587af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
	5   AppKit                              0x00007fff994d9ebe -[NSApplication run] + 1000
	6   libpcl_visualization.1.8.dylib      0x000000011c54bb55 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 357
	7   libpcl_visualization.1.8.dylib      0x000000011c5de769 _ZN3pcl13visualization11CloudViewer16CloudViewer_implclEv + 3129
	8   libpcl_visualization.1.8.dylib      0x000000011c5dd1ec _ZN5boost6detail11thread_dataINS_17reference_wrapperIN3pcl13visualization11CloudViewer16CloudViewer_implEEEE3runEv + 28
	9   libboost_thread-mt.dylib            0x000000010fa66715 _ZN5boost12_GLOBAL__N_112thread_proxyEPv + 53
	10  libsystem_pthread.dylib             0x00007fff9b94399d _pthread_body + 131
	11  libsystem_pthread.dylib             0x00007fff9b94391a _pthread_body + 0
	12  libsystem_pthread.dylib             0x00007fff9b941351 thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
$ 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pcl/visualization/cloud_viewer.h and trace the CloudViewer_impl and PCLVisualizer::spinOnce entry points named in the macOS stack trace. Reproduce the minimal C++ example on macOS, then verify that opening an empty CloudViewer window no longer triggers the main-thread assertion or aborts.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, macos
Domain
computer-vision, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.