Hey everyone,
I encountered a little problem while trying to create a dynamic library with custom components in it.
I want to build a software which can be extended by plug-ins (not audio plug-ins). The users can build their own plug-ins (dynamic libraries) which can be loaded during runtime (by loading a JSON file containing the paths to the libraries).
The dynamic libraries expose a single function getCreator()
which returns a Creator
object which will be used in a factory design pattern. The Creator
can create an object on demand, and this object has its own custom component, which will be displayed within the main program.
Within the library I call initialiseJuce_GUI();
otherwise the component won’t show and some assertions are thrown.
Creating the dynamic libraries works like a charm, however, once I add the component from the library to my main component, two things happen:
-
Dynamic cast errors
Now and then, I get a bunch of those errors displayed in the debug console:
2019-12-19 15:41:20.039460+0100 vLEx[20744:1305019] dynamic_cast error 2: One or more of the following type_info's has hidden visibility. They should all have public visibility. N4juce9ComponentE, N4juce10TextButtonE, N4juce14TopLevelWindowE.
The custom component has only aTextButton
as a member so I guess the custom component might be the culprit. -
Leaking MouseCursors
Once I move the mouse above the custom component, theLeakedObjectDetector
throws an assertion:
Dangling pointer deletion! Class: MouseCursor
JUCE Assertion failure in juce_LeakedObjectDetector.h:66
The stack:
|#0|0x00000001006a18a9 in juce::LeakedObjectDetector<juce::MouseCursor>::~LeakedObjectDetector() at /Applications/JUCE/modules/juce_core/memory/juce_LeakedObjectDetector.h:66|
|---|---|
|#1|0x000000010051add5 in juce::LeakedObjectDetector<juce::MouseCursor>::~LeakedObjectDetector() at /Applications/JUCE/modules/juce_core/memory/juce_LeakedObjectDetector.h:50|
|#2|0x000000010051acd2 in juce::MouseCursor::~MouseCursor() at /Applications/JUCE/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp:164|
|#3|0x00000001005020c5 in juce::MouseCursor::~MouseCursor() at /Applications/JUCE/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp:161|
|#4|0x000000010051233e in juce::MouseInputSourceInternal::revealCursor(bool) at /Applications/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:507|
|#5|0x00000001005f0809 in juce::MouseInputSourceInternal::setScreenPos(juce::Point<float>, juce::Time, bool) at /Applications/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:295|
|#6|0x00000001005127a3 in juce::MouseInputSourceInternal::handleEvent(juce::ComponentPeer&, juce::Point<float>, juce::Time, juce::ModifierKeys, float, float, juce::PenDetails) at /Applications/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:340|
|#7|0x0000000100512492 in juce::MouseInputSource::handleEvent(juce::ComponentPeer&, juce::Point<float>, long long, juce::ModifierKeys, float, float, juce::PenDetails const&) at /Applications/JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp:634|
|#8|0x00000001005d28dd in juce::ComponentPeer::handleMouseEvent(juce::MouseInputSource::InputSourceType, juce::Point<float>, juce::ModifierKeys, float, float, long long, juce::PenDetails, int) at /Applications/JUCE/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:88|
|#9|0x0000000100679eb0 in juce::NSViewComponentPeer::sendMouseEvent(NSEvent*) at /Applications/JUCE/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:701|
|#10|0x000000010067a6d1 in juce::NSViewComponentPeer::redirectMouseMove(NSEvent*) at /Applications/JUCE/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:601|
|#11|0x0000000100676ef9 in juce::JuceNSViewClass::mouseMoved(objc_object*, objc_selector*, NSEvent*) at /Applications/JUCE/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:1647|
|#12|0x00007fff36e6f367 in -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] ()|
|#13|0x00007fff36e6d667 in -[NSWindow(NSEventRouting) sendEvent:] ()|
|#14|0x00007fff36d0d3ab in -[NSApplication(NSEvent) sendEvent:] ()|
|#15|0x00007fff36cfb5c0 in -[NSApplication run] ()|
|#16|0x00000001003e1ef2 in juce::MessageManager::runDispatchLoop() at /Applications/JUCE/modules/juce_events/native/juce_mac_MessageManager.mm:343|
|#17|0x00000001003e1dc7 in juce::JUCEApplicationBase::main() at /Applications/JUCE/modules/juce_events/messages/juce_ApplicationBase.cpp:262|
|#18|0x00000001003e1bdc in juce::JUCEApplicationBase::main(int, char const**) at /Applications/JUCE/modules/juce_events/messages/juce_ApplicationBase.cpp:240|
It seems to be the same problem as this: Error "Dangling pointer deletion! Class: MouseCursor" when exporting Juce Component from DLL
What am I doing wrong? Every help is very much appreciated!