Browse Source

Introjucer: shutdown fix.

tags/2021-05-28
jules 12 years ago
parent
commit
bb37710eca
3 changed files with 28 additions and 23 deletions
  1. +14
    -9
      extras/Introjucer/Source/Application/jucer_Application.h
  2. +13
    -13
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp
  3. +1
    -1
      modules/juce_core/memory/juce_Memory.h

+ 14
- 9
extras/Introjucer/Source/Application/jucer_Application.h View File

@@ -127,20 +127,20 @@ public:
//============================================================================== //==============================================================================
void systemRequestedQuit() void systemRequestedQuit()
{ {
if ((! triggerAsyncQuitIfModalCompsActive())
&& mainWindowList.askAllWindowsToClose())
quit();
closeModalCompsAndQuit();
} }
bool triggerAsyncQuitIfModalCompsActive()
void closeModalCompsAndQuit()
{ {
if (cancelAnyModalComponents()) if (cancelAnyModalComponents())
{ {
new AsyncQuitRetrier(); new AsyncQuitRetrier();
return true;
} }
return false;
else
{
if (closeAllMainWindows())
quit();
}
} }
//============================================================================== //==============================================================================
@@ -439,6 +439,11 @@ public:
return openDocumentManager.closeAll (askUserToSave); return openDocumentManager.closeAll (askUserToSave);
} }
virtual bool closeAllMainWindows()
{
return mainWindowList.askAllWindowsToClose();
}
bool makeSureUserHasSelectedModuleFolder() bool makeSureUserHasSelectedModuleFolder()
{ {
if (! ModuleList::isLocalModulesFolderValid()) if (! ModuleList::isLocalModulesFolderValid())
@@ -552,8 +557,8 @@ private:
stopTimer(); stopTimer();
delete this; delete this;
if (JUCEApplication* app = JUCEApplication::getInstance())
app->systemRequestedQuit();
if (JUCEApplication::getInstance() != nullptr)
IntrojucerApp::getApp().closeModalCompsAndQuit();
} }
JUCE_DECLARE_NON_COPYABLE (AsyncQuitRetrier); JUCE_DECLARE_NON_COPYABLE (AsyncQuitRetrier);


+ 13
- 13
extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp View File

@@ -175,9 +175,7 @@ StringArray getSearchPathsFromString (const String& searchPath)
//============================================================================== //==============================================================================
void autoScrollForMouseEvent (const MouseEvent& e, bool scrollX, bool scrollY) void autoScrollForMouseEvent (const MouseEvent& e, bool scrollX, bool scrollY)
{ {
Viewport* const viewport = e.eventComponent->findParentComponentOfClass<Viewport>();
if (viewport != nullptr)
if (Viewport* const viewport = e.eventComponent->findParentComponentOfClass<Viewport>())
{ {
const MouseEvent e2 (e.getEventRelativeTo (viewport)); const MouseEvent e2 (e.getEventRelativeTo (viewport));
viewport->autoScroll (scrollX ? e2.x : 20, scrollY ? e2.y : 20, 8, 16); viewport->autoScroll (scrollX ? e2.x : 20, scrollY ? e2.y : 20, 8, 16);
@@ -250,8 +248,7 @@ String RolloverHelpComp::findTip (Component* c)
{ {
while (c != nullptr) while (c != nullptr)
{ {
TooltipClient* const tc = dynamic_cast <TooltipClient*> (c);
if (tc != nullptr)
if (TooltipClient* const tc = dynamic_cast <TooltipClient*> (c))
{ {
const String tip (tc->getTooltip()); const String tip (tc->getTooltip());
@@ -278,7 +275,8 @@ void FloatingLabelComponent::remove()
getParentComponent()->removeChildComponent (this); getParentComponent()->removeChildComponent (this);
} }
void FloatingLabelComponent::update (Component* parent, const String& text, const Colour& textColour, int x, int y, bool toRight, bool below)
void FloatingLabelComponent::update (Component* parent, const String& text, const Colour& textColour,
int x, int y, bool toRight, bool below)
{ {
colour = textColour; colour = textColour;
@@ -322,7 +320,8 @@ class UTF8Component : public Component,
public: public:
UTF8Component() UTF8Component()
: desc (String::empty, : desc (String::empty,
"Type any string into the box, and it'll be shown below as a portable UTF-8 literal, ready to cut-and-paste into your source-code...")
"Type any string into the box, and it'll be shown below as a portable UTF-8 literal, "
"ready to cut-and-paste into your source-code...")
{ {
desc.setJustificationType (Justification::centred); desc.setJustificationType (Justification::centred);
desc.setColour (Label::textColourId, Colours::white); desc.setColour (Label::textColourId, Colours::white);
@@ -395,23 +394,24 @@ void showUTF8ToolWindow (ScopedPointer<Component>& ownerPointer)
} }
} }
//==============================================================================
bool cancelAnyModalComponents() bool cancelAnyModalComponents()
{ {
const int numModal = ModalComponentManager::getInstance()->getNumModalComponents();
ModalComponentManager& mm = *ModalComponentManager::getInstance();
const int numModal = mm.getNumModalComponents();
for (int i = numModal; --i >= 0;) for (int i = numModal; --i >= 0;)
if (ModalComponentManager::getInstance()->getModalComponent(i) != nullptr)
ModalComponentManager::getInstance()->getModalComponent(i)->exitModalState (0);
if (mm.getModalComponent(i) != nullptr)
mm.getModalComponent(i)->exitModalState (0);
return numModal > 0; return numModal > 0;
} }
//==============================================================================
class AsyncCommandRetrier : public Timer class AsyncCommandRetrier : public Timer
{ {
public: public:
AsyncCommandRetrier (const ApplicationCommandTarget::InvocationInfo& info_)
: info (info_)
AsyncCommandRetrier (const ApplicationCommandTarget::InvocationInfo& inf)
: info (inf)
{ {
info.originatingComponent = nullptr; info.originatingComponent = nullptr;
startTimer (500); startTimer (500);


+ 1
- 1
modules/juce_core/memory/juce_Memory.h View File

@@ -97,7 +97,7 @@ inline Type* createCopyIfNotNull (const Type* pointer) { return pointer != n
extern JUCE_API void juceDLL_free (void*); extern JUCE_API void juceDLL_free (void*);
#define JUCE_LEAK_DETECTOR(OwnerClass) public:\ #define JUCE_LEAK_DETECTOR(OwnerClass) public:\
static void* operator new (size_t sz) { return juce::juceDLL_malloc ((int) sz); } \
static void* operator new (size_t sz) { return juce::juceDLL_malloc (sz); } \
static void* operator new (size_t, void* p) { return p; } \ static void* operator new (size_t, void* p) { return p; } \
static void operator delete (void* p) { juce::juceDLL_free (p); } \ static void operator delete (void* p) { juce::juceDLL_free (p); } \
static void operator delete (void*, void*) {} static void operator delete (void*, void*) {}


Loading…
Cancel
Save