1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-08 04:20:09 +00:00

Projucer: Fixed a crash in ProjectTab caused by not removing it as a global focus change listener in its destructor

This commit is contained in:
ed 2017-06-21 10:08:30 +01:00
parent f1dc2a71f3
commit a3655ec17d

View file

@ -251,6 +251,8 @@ public:
{
treeToDisplay = nullptr;
popupMenuButton = nullptr;
findPanel = nullptr;
settingsButton = nullptr;
}
void resized() override
@ -340,6 +342,11 @@ private:
lookAndFeelChanged();
}
~FindPanel()
{
Desktop::getInstance().removeFocusChangeListener (this);
}
void paintOverChildren (Graphics& g) override
{
if (! isFocused)
@ -402,7 +409,6 @@ private:
//==============================================================================
class ProjectTab : public Component,
public ApplicationCommandTarget,
private ChangeListener
{
public:
@ -491,42 +497,6 @@ public:
return ((float) (concertinaPanel.getPanel (panelIndex)->getHeight()) / (concertinaPanel.getHeight() - 90));
}
//==============================================================================
ApplicationCommandTarget* getNextCommandTarget() override { return nullptr; }
void getAllCommands (Array <CommandID>& commands) override
{
const CommandID ids[] = { CommandIDs::showFindPanel };
commands.addArray (ids, numElementsInArray (ids));
}
void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) override
{
switch (commandID)
{
case CommandIDs::showFindPanel:
result.setInfo (TRANS ("Find"), TRANS ("Searches for ."), "Editing", 0);
result.defaultKeypresses.add (KeyPress ('f', ModifierKeys::commandModifier, 0));
break;
default:
break;
}
}
bool perform (const InvocationInfo& info) override
{
if (info.commandID == CommandIDs::showFindPanel)
{
find();
return true;
}
return false;
}
private:
ConcertinaPanel concertinaPanel;
OwnedArray<ConcertinaHeader> headers;
@ -593,13 +563,5 @@ private:
}
}
void find()
{
showPanel (0);
if (auto* treeComponent = dynamic_cast<ConcertinaTreeComponent*> (concertinaPanel.getPanel (0)))
treeComponent->grabFindFocus();
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectTab)
};