iOS: MouseInputSource leaks


#1

Anyone else seeing this with iOS? No leaks from this app on other platforms.

EDIT - this happens when using a DocumentWindow and clicking the close button in the title bar. If I use JUCEApplication:quit() I see a leaked KeyPress instead.

*** Leaked objects detected: 3 instance(s) of class MouseInputSource

JUCE Assertion failure in juce_LeakedObjectDetector.h:95

Stack trace:

​Juce Message Thread (1)Queue : com.apple.main-thread (serial)
#0    0x0000000104a46292 in __kill ()
#1    0x00000001018d2eff in juce::LeakedObjectDetector<juce::MouseInputSource>::LeakCounter::~LeakCounter() at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/../juce_graphics/../juce_core/memory/juce_LeakedObjectDetector.h:95
#2    0x00000001018d2df5 in juce::LeakedObjectDetector<juce::MouseInputSource>::LeakCounter::~LeakCounter() at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/../juce_graphics/../juce_core/memory/juce_LeakedObjectDetector.h:83
#3    0x00000001047d7f01 in __cxa_finalize_ranges ()
#4    0x00000001047d822f in exit ()
#5    0x0000000101686f63 in juce::MessageManager::stopDispatchLoop() at /Users/andrew/Develop/JUCE/modules/juce_events/native/juce_ios_MessageManager.mm:34
#6    0x0000000101686e81 in juce::JUCEApplicationBase::quit() at /Users/andrew/Develop/JUCE/modules/juce_events/messages/juce_ApplicationBase.cpp:66
#7    0x000000010159a321 in ForumJunkieApplication::systemRequestedQuit() at /Users/andrew/Develop/obApps/Forum Junkie/Source/Main.cpp:74
#8    0x000000010159a532 in MainWindow::closeButtonPressed() at /Users/andrew/Develop/obApps/Forum Junkie/Source/Main.cpp:115
#9    0x00000001018dc353 in juce::DocumentWindow::ButtonListenerProxy::buttonClicked(juce::Button*) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/windows/juce_DocumentWindow.cpp:34
#10    0x0000000101871f66 in void juce::ListenerList<juce::Button::Listener, juce::Array<juce::Button::Listener*, juce::DummyCriticalSection, 0> >::callChecked<juce::Component::BailOutChecker, juce::Button*>(juce::Component::BailOutChecker const&, void (juce::Button::Listener::*)(juce::Button*), juce::TypeHelpers::ParameterType<juce::Button*>::type) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/../juce_graphics/../juce_events/broadcasters/juce_ListenerList.h:178
#11    0x00000001017bb114 in juce::Button::sendClickMessage(juce::ModifierKeys const&) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/buttons/juce_Button.cpp:410
#12    0x00000001017bb797 in juce::Button::internalClickCallback(juce::ModifierKeys const&) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/buttons/juce_Button.cpp:354
#13    0x00000001017bbd9b in juce::Button::mouseUp(juce::MouseEvent const&) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/buttons/juce_Button.cpp:460
#14    0x00000001017af859 in juce::Component::internalMouseUp(juce::MouseInputSource, juce::Point<float>, juce::Time, juce::ModifierKeys) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/components/juce_Component.cpp:2495
#15    0x00000001018d9386 in juce::MouseInputSourceInternal::sendMouseUp(juce::Component&, juce::Point<float>, juce::Time, juce::ModifierKeys) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:147
#16    0x00000001018d8df3 in juce::MouseInputSourceInternal::setButtons(juce::Point<float>, juce::Time, juce::ModifierKeys) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:189
#17    0x000000010186ec57 in juce::MouseInputSourceInternal::handleEvent(juce::ComponentPeer&, juce::Point<float>, juce::Time, juce::ModifierKeys) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:306
#18    0x00000001017b267f in juce::MouseInputSource::handleEvent(juce::ComponentPeer&, juce::Point<float>, long long, juce::ModifierKeys) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:567
#19    0x0000000101856af9 in juce::ComponentPeer::handleMouseEvent(int, juce::Point<float>, juce::ModifierKeys, long long) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:91
#20    0x0000000101865012 in juce::UIViewComponentPeer::handleTouches(UIEvent*, bool, bool, bool) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm:808
#21    0x00000001018651b8 in -[JuceUIView touchesEnded:withEvent:] at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm:427
#22    0x0000000102d28308 in -[UIWindow _sendTouchesForEvent:] ()
#23    0x0000000102d28c33 in -[UIWindow sendEvent:] ()
#24    0x0000000102cf59b1 in -[UIApplication sendEvent:] ()
#25    0x0000000102d02a7d in _UIApplicationHandleEventFromQueueEvent ()
#26    0x0000000102cde103 in _UIApplicationHandleEventQueue ()
#27    0x00000001040f2551 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#28    0x00000001040e841d in __CFRunLoopDoSources0 ()
#29    0x00000001040e7a54 in __CFRunLoopRun ()
#30    0x00000001040e7486 in CFRunLoopRunSpecific ()
#31    0x0000000105ca79f0 in GSEventRunModal ()
#32    0x0000000102ce1420 in UIApplicationMain ()
#33    0x000000010186870f in juce::juce_iOSMain(int, char const**) at /Users/andrew/Develop/JUCE/modules/juce_gui_basics/native/juce_ios_Windowing.mm:95
#34    0x000000010168722e in juce::JUCEApplicationBase::main(int, char const**) at /Users/andrew/Develop/JUCE/modules/juce_events/messages/juce_ApplicationBase.cpp:216
#35    0x000000010159a573 in main at /Users/andrew/Develop/obApps/Forum Junkie/Source/Main.cpp:120
#36    0x0000000104729145 in start ()

 


#2

iOS has never been very friendly about letting apps shutdown cleanly, and I think they might be killed by calling std::exit (0). Theat will bypass all the normal juce clean-up code but still allows static destructors to run, which will include the leak detector, so it's probably a false alarm.


#3

OK thanks.

I don’t notice any leaks if I close the app using the iOS task manager - so I’m happy to think of it as being a false alarm :slight_smile: