Browse Source

PIPs: Changed the Component Main.cpp wrapper to avoid a crash that would happen on quit when using the live-build engine on Windows

tags/2021-05-28
ed 7 years ago
parent
commit
7d36760efd
4 changed files with 21 additions and 13 deletions
  1. +10
    -6
      extras/Projucer/JuceLibraryCode/BinaryData.cpp
  2. +1
    -1
      extras/Projucer/JuceLibraryCode/BinaryData.h
  3. +9
    -5
      extras/Projucer/Source/BinaryData/Templates/jucer_PIPMain.cpp
  4. +1
    -1
      extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp

+ 10
- 6
extras/Projucer/JuceLibraryCode/BinaryData.cpp View File

@@ -7193,10 +7193,11 @@ static const unsigned char temp_binary_data_53[] =
" class MainWindow : public DocumentWindow\r\n"
" {\r\n"
" public:\r\n"
" MainWindow (const String& name, Component* c) : DocumentWindow (name,\r\n"
" Desktop::getInstance().getDefaultLookAndFeel()\r\n"
" .findColour (ResizableWindow::backgroundColourId),\r\n"
" DocumentWindow::allButtons)\r\n"
" MainWindow (const String& name, Component* c, JUCEApplication& a)\r\n"
" : DocumentWindow (name, Desktop::getInstance().getDefaultLookAndFeel()\r\n"
" .findColour (ResizableWindow::backgroundColourId),\r\n"
" DocumentWindow::allButtons),\r\n"
" app (a)\r\n"
" {\r\n"
" setUsingNativeTitleBar (true);\r\n"
" setContentOwned (c, true);\r\n"
@@ -7214,10 +7215,13 @@ static const unsigned char temp_binary_data_53[] =
"\r\n"
" void closeButtonPressed() override\r\n"
" {\r\n"
" JUCEApplication::getInstance()->systemRequestedQuit();\r\n"
" app.systemRequestedQuit();\r\n"
" }\r\n"
"\r\n"
" private:\r\n"
" JUCEApplication& app;\r\n"
"\r\n"
" //==============================================================================\r\n"
" JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)\r\n"
" };\r\n"
" ScopedPointer<MainWindow> mainWindow;\r\n"
@@ -7641,7 +7645,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) noexc
case 0x7fbac252: numBytes = 1665; return jucer_OpenGLComponentTemplate_cpp;
case 0x491fa0d7: numBytes = 1263; return jucer_OpenGLComponentTemplate_h;
case 0xbc050edc: numBytes = 4926; return jucer_PIPAudioProcessorTemplate_h;
case 0xf4ca9e9a: numBytes = 2446; return jucer_PIPMain_cpp;
case 0xf4ca9e9a: numBytes = 2443; return jucer_PIPMain_cpp;
case 0x0b16e320: numBytes = 517; return jucer_PIPTemplate_h;
case 0x763d39dc: numBytes = 1050; return colourscheme_dark_xml;
case 0xe8b08520: numBytes = 1050; return colourscheme_light_xml;


+ 1
- 1
extras/Projucer/JuceLibraryCode/BinaryData.h View File

@@ -168,7 +168,7 @@ namespace BinaryData
const int jucer_PIPAudioProcessorTemplate_hSize = 4926;
extern const char* jucer_PIPMain_cpp;
const int jucer_PIPMain_cppSize = 2446;
const int jucer_PIPMain_cppSize = 2443;
extern const char* jucer_PIPTemplate_h;
const int jucer_PIPTemplate_hSize = 517;


+ 9
- 5
extras/Projucer/Source/BinaryData/Templates/jucer_PIPMain.cpp View File

@@ -26,10 +26,11 @@ private:
class MainWindow : public DocumentWindow
{
public:
MainWindow (const String& name, Component* c) : DocumentWindow (name,
Desktop::getInstance().getDefaultLookAndFeel()
.findColour (ResizableWindow::backgroundColourId),
DocumentWindow::allButtons)
MainWindow (const String& name, Component* c, JUCEApplication& a)
: DocumentWindow (name, Desktop::getInstance().getDefaultLookAndFeel()
.findColour (ResizableWindow::backgroundColourId),
DocumentWindow::allButtons),
app (a)
{
setUsingNativeTitleBar (true);
setContentOwned (c, true);
@@ -47,10 +48,13 @@ private:
void closeButtonPressed() override
{
JUCEApplication::getInstance()->systemRequestedQuit();
app.systemRequestedQuit();
}
private:
JUCEApplication& app;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
};
ScopedPointer<MainWindow> mainWindow;


+ 1
- 1
extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp View File

@@ -512,7 +512,7 @@ String PIPGenerator::getMainFileTextForType()
mainTemplate = mainTemplate.replace ("%%project_version%%", metadata[Ids::version].toString());
return ensureCorrectWhitespace (mainTemplate.replace ("%%startup%%", "mainWindow = new MainWindow (" + metadata[Ids::name].toString().quoted()
+ ", new " + metadata[Ids::mainClass].toString() + "());")
+ ", new " + metadata[Ids::mainClass].toString() + "(), *this);")
.replace ("%%shutdown%%", "mainWindow = nullptr;"));
}
else if (type == "AudioProcessor")


Loading…
Cancel
Save