diff --git a/modules/juce_gui_basics/widgets/juce_Label.cpp b/modules/juce_gui_basics/widgets/juce_Label.cpp index c353a773bb..a7a1851af5 100644 --- a/modules/juce_gui_basics/widgets/juce_Label.cpp +++ b/modules/juce_gui_basics/widgets/juce_Label.cpp @@ -131,16 +131,17 @@ void Label::setBorderSize (BorderSize newBorder) //============================================================================== Component* Label::getAttachedComponent() const { - return static_cast (ownerComponent); + return ownerComponent.get(); } void Label::attachToComponent (Component* owner, bool onLeft) { + jassert (owner != this); // Not a great idea to try to attach it to itself! + if (ownerComponent != nullptr) ownerComponent->removeComponentListener (this); ownerComponent = owner; - leftOfOwnerComp = onLeft; if (ownerComponent != nullptr)