openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.91k stars 2.55k forks source link

ofxOscParameterSync crashes on exit #2653

Open jvcleave opened 10 years ago

jvcleave commented 10 years ago

Mac 10.8, Xcode 5.01

Running the oscParametersSender or oscParametersReceiver example and exiting the app causes an Poco exception in ~ofxOscParameterSync when it goes to remove the listener

screen shot 2013-10-29 at 11 14 39 pm

removing the ofRemoveListener... allows the app to exit cleanly

backtrace

libc++abi.dylib: terminate called throwing an exception
(lldb) bt
* thread #1: tid = 0x33cb96, 0x9615aa6a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread, stop reason = signal SIGABRT
    frame #0: 0x9615aa6a libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x957aeb2f libsystem_c.dylib`pthread_kill + 101
    frame #2: 0x957e5631 libsystem_c.dylib`abort + 168
    frame #3: 0x957777e0 libc++abi.dylib`abort_message + 151
    frame #4: 0x95775249 libc++abi.dylib`default_terminate() + 34
    frame #5: 0x95775289 libc++abi.dylib`safe_handler_caller(void (*)()) + 13
    frame #6: 0x957752f1 libc++abi.dylib`std::terminate() + 23
    frame #7: 0x957763e6 libc++abi.dylib`__cxa_throw + 110
    frame #8: 0x00009ce3 oscParametersSenderDebug`Poco::MutexImpl::lockImpl(this=0x032823c8) + 195 at Mutex_POSIX.h:82
    frame #9: 0x00009c17 oscParametersSenderDebug`Poco::FastMutex::lock(this=0x032823c8) + 23 at Mutex.h:259
    frame #10: 0x00022a94 oscParametersSenderDebug`Poco::ScopedLock<Poco::FastMutex>::ScopedLock(this=0xbfffeb38, mutex=0x032823c8) + 36 at ScopedLock.h:60
    frame #11: 0x00022a24 oscParametersSenderDebug`Poco::ScopedLock<Poco::FastMutex>::ScopedLock(this=0xbfffeb38, mutex=0x032823c8) + 36 at ScopedLock.h:61
    frame #12: 0x000228ec oscParametersSenderDebug`Poco::AbstractEvent<ofAbstractParameter, Poco::PriorityStrategy<ofAbstractParameter, Poco::AbstractPriorityDelegate<ofAbstractParameter> >, Poco::AbstractPriorityDelegate<ofAbstractParameter>, Poco::FastMutex>::operator-=(this=0x032823a4, aDelegate=0xbfffeb90) + 44 at AbstractEvent.h:205
    frame #13: 0x000226af oscParametersSenderDebug`void ofRemoveListener<ofEvent<ofAbstractParameter>, ofAbstractParameter, ofxOscParameterSync>(event=0x032823a4, listener=0x03282210, listenerMethod=d0 21 02 00 00 00 00 00, prio=200)(ofAbstractParameter&), int) + 143 at ofEventUtils.h:119
    frame #14: 0x00022142 oscParametersSenderDebug`ofxOscParameterSync::~ofxOscParameterSync(this=0x03282210) + 98 at ofxOscParameterSync.cpp:17
    frame #15: 0x000220d7 oscParametersSenderDebug`ofxOscParameterSync::~ofxOscParameterSync(this=0x03282210) + 23 at ofxOscParameterSync.cpp:15
    frame #16: 0x0001b3e6 oscParametersSenderDebug`ofApp::~ofApp(this=0x03282200) + 182 at ofApp.h:7
    frame #17: 0x00018c57 oscParametersSenderDebug`ofApp::~ofApp(this=0x03282200) + 23 at ofApp.h:7
    frame #18: 0x00018c7a oscParametersSenderDebug`ofApp::~ofApp(this=0x03282200) + 26 at ofApp.h:7
    frame #19: 0x00324968 oscParametersSenderDebug`std::tr1::_Sp_counted_base_impl<ofBaseApp*, std::tr1::_Sp_deleter<ofBaseApp>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() [inlined] std::tr1::_Sp_deleter<ofBaseApp>::operator(__p=<unavailable>)(ofBaseApp*) const + 24 at boost_shared_ptr.h:94
    frame #20: 0x00324960 oscParametersSenderDebug`std::tr1::_Sp_counted_base_impl<ofBaseApp*, std::tr1::_Sp_deleter<ofBaseApp>, (this=0x01b5be50)2>::_M_dispose() + 16 at boost_shared_ptr.h:246
    frame #21: 0x00003970 oscParametersSenderDebug`std::tr1::_Sp_counted_base<(this=0x01b5be50)2>::_M_release() + 80 at boost_shared_ptr.h:145
    frame #22: 0x00320e08 oscParametersSenderDebug`ofPtr<ofBaseApp>::~ofPtr() [inlined] std::tr1::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() + 24 at boost_shared_ptr.h:300
    frame #23: 0x00320df9 oscParametersSenderDebug`ofPtr<ofBaseApp>::~ofPtr() [inlined] std::tr1::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() at boost_shared_ptr.h:298
    frame #24: 0x00320df9 oscParametersSenderDebug`ofPtr<ofBaseApp>::~ofPtr() [inlined] std::tr1::__shared_ptr<ofBaseApp, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() at boost_shared_ptr.h:503
    frame #25: 0x00320df9 oscParametersSenderDebug`ofPtr<ofBaseApp>::~ofPtr() [inlined] std::tr1::shared_ptr<ofBaseApp>::~shared_ptr() at boost_shared_ptr.h:972
    frame #26: 0x00320df9 oscParametersSenderDebug`ofPtr<ofBaseApp>::~ofPtr() [inlined] ofPtr<ofBaseApp>::~ofPtr(this=<unavailable>) at ofTypes.h:139
    frame #27: 0x00320df9 oscParametersSenderDebug`ofPtr<ofBaseApp>::~ofPtr(this=0x006b54f4) + 9 at ofTypes.h:139
    frame #28: 0x957e946a libsystem_c.dylib`__cxa_finalize + 184
    frame #29: 0x957eadb2 libsystem_c.dylib`exit + 23
    frame #30: 0x00369352 oscParametersSenderDebug`ofAppGLFWWindow::exit_cb(windowP_=0x0228c600) + 18 at ofAppGLFWWindow.cpp:232
    frame #31: 0x0031d108 oscParametersSenderDebug`-[GLFWApplicationDelegate applicationShouldTerminate:] + 40
    frame #32: 0x90d901b0 AppKit`-[NSApplication _docController:shouldTerminate:] + 83
    frame #33: 0x90d90118 AppKit`__91-[NSDocumentController(NSInternal) _closeAllDocumentsWithDelegate:shouldTerminateSelector:]_block_invoke_0 + 253
    frame #34: 0x90d8fe4b AppKit`-[NSDocumentController(NSInternal) _closeAllDocumentsWithDelegate:shouldTerminateSelector:] + 1526
    frame #35: 0x90d8f838 AppKit`-[NSDocumentController(NSInternal) __closeAllDocumentsWithDelegate:shouldTerminateSelector:] + 266
    frame #36: 0x90d8f708 AppKit`-[NSApplication _shouldTerminate] + 871
    frame #37: 0x90d8e83c AppKit`-[NSApplication terminate:] + 1143
    frame #38: 0x9083b5d3 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
    frame #39: 0x90c51ad2 AppKit`-[NSApplication sendAction:to:from:] + 436
    frame #40: 0x90d8e2fc AppKit`-[NSMenuItem _corePerformAction] + 529
    frame #41: 0x90d8df8b AppKit`-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 163
    frame #42: 0x90d8d614 AppKit`-[NSMenu _performActionWithHighlightingForItemAtIndex:sendAccessibilityNotification:] + 79
    frame #43: 0x90d8d5c0 AppKit`-[NSMenu _performActionWithHighlightingForItemAtIndex:] + 48
    frame #44: 0x90d8cac5 AppKit`-[NSMenu performKeyEquivalent:] + 306
    frame #45: 0x90d8be7c AppKit`-[NSApplication _handleKeyEquivalent:] + 915
    frame #46: 0x90c41de1 AppKit`-[NSApplication sendEvent:] + 5512
    frame #47: 0x0031e2e4 oscParametersSenderDebug`-[GLFWApplication sendEvent:] + 148
    frame #48: 0x0031f138 oscParametersSenderDebug`_glfwPlatformPollEvents + 72
    frame #49: 0x00369f1b oscParametersSenderDebug`ofAppGLFWWindow::display(this=<unavailable>) + 335 at ofAppGLFWWindow.cpp:357
    frame #50: 0x00369dc9 oscParametersSenderDebug`ofAppGLFWWindow::runAppViaInfiniteLoop(this=0x00d4d400, appPtr=0x03282200) + 55 at ofAppGLFWWindow.cpp:287
    frame #51: 0x003200fd oscParametersSenderDebug`ofRunApp(OFSA=0x03282200) + 1120 at ofAppRunner.cpp:137
    frame #52: 0x000028ea oscParametersSenderDebug`main + 106 at main.cpp:13
bilderbuchi commented 10 years ago

I can confirm the poco exception on Linux. @arturoc do you know what's going on?

arturoc commented 10 years ago

it's probably related with the destruction order, i don't think it's a good idea to not remove the listener though, if the object is destroyed while the app is running it'll crash when the event is triggered again

jvcleave commented 10 years ago

A workaround that is working for me (also works in the examples) is to use a pointer forofxOscParameterSync

tpltnt commented 9 years ago

If the examples in question are "addons/oscSenderExample" and "addons/oscReceiveExample", then I can not replicate this bug on Debian (64bit) as of b5db2ccc97bbe7406ca5fa1feaff4f3cfdf2012b. @bilderbuchi can you confirm this?

bilderbuchi commented 9 years ago

Those are not the correct examples, the correct ones are in https://github.com/openframeworks/openFrameworks/tree/master/examples/gui with the names as in the OP.

bakercp commented 7 years ago

@jvcleave can you confirm this error in the latest master?