diff --git a/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp b/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp index 8715e149b0..c4d025ac1d 100644 --- a/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp +++ b/src/juce_appframework/gui/components/controls/juce_ComboBox.cpp @@ -64,7 +64,9 @@ ComboBox::ComboBox (const String& name) ComboBox::~ComboBox() { - jassert (! menuActive); // deleting the combo box while it's in use? Probably not a great idea. + if (menuActive) + PopupMenu::dismissAllActiveMenus(); + deleteAllChildren(); } @@ -517,6 +519,7 @@ void ComboBox::showPopup() if (! menuActive) { const int currentId = getSelectedId(); + ComponentDeletionWatcher deletionWatcher (this); PopupMenu menu; @@ -542,6 +545,10 @@ void ComboBox::showPopup() menuActive = true; const int resultId = menu.showAt (this, currentId, getWidth(), 1, itemHeight); + + if (deletionWatcher.hasBeenDeleted()) + return; + menuActive = false; if (resultId != 0)