Browse Source

Fixed a crash on quit when windows are open in the Juce Demo's windows demo

tags/2021-05-28
hogliux 8 years ago
parent
commit
26e0aa735c
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      examples/Demo/Source/Demos/WindowsDemo.cpp

+ 14
- 2
examples/Demo/Source/Demos/WindowsDemo.cpp View File

@@ -212,6 +212,15 @@ public:
~WindowsDemo() ~WindowsDemo()
{ {
if (dialogWindow != nullptr)
{
dialogWindow->exitModalState (0);
// we are shutting down: can't wait for the message manager
// to eventually delete this
delete dialogWindow;
}
closeAllWindows(); closeAllWindows();
closeWindowsButton.removeListener (this); closeWindowsButton.removeListener (this);
@@ -239,6 +248,7 @@ private:
// null when the component that it points to is deleted. // null when the component that it points to is deleted.
Array< Component::SafePointer<Component> > windows; Array< Component::SafePointer<Component> > windows;
TextButton showWindowsButton, closeWindowsButton; TextButton showWindowsButton, closeWindowsButton;
SafePointer<DialogWindow> dialogWindow;
void showAllWindows() void showAllWindows()
{ {
@@ -282,8 +292,10 @@ private:
options.useNativeTitleBar = false; options.useNativeTitleBar = false;
options.resizable = true; options.resizable = true;
DialogWindow* dw = options.launchAsync();
dw->centreWithSize (300, 200);
dialogWindow = options.launchAsync();
if (dialogWindow != nullptr)
dialogWindow->centreWithSize (300, 200);
} }
void showDocumentWindow (bool native) void showDocumentWindow (bool native)


Loading…
Cancel
Save