From: kunitoki Date: Mon, 16 Mar 2020 12:01:47 +0000 (+0100) Subject: Don't fail fatally if gui cannot connect to X server X-Git-Tag: archive/raspbian/5.4.7_ds0-2+rpi1^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bc0795db95bc628fab60f39c2fb704f6dd0a6a3b;p=juce.git Don't fail fatally if gui cannot connect to X server Bug: https://github.com/WeAreROLI/JUCE/issues/422 This is a slight modification of https://github.com/WeAreROLI/JUCE/issues/422 by IOhannes m zmölnig, using early exits rather than longish if-clauses (mainly to minimize the diff). Gbp-Pq: Name 0011-Don-t-fail-fatally-if-gui-cannot-connect-to-X-server.patch --- diff --git a/modules/juce_gui_basics/native/juce_linux_X11.cpp b/modules/juce_gui_basics/native/juce_linux_X11.cpp index a2ceb670..7d675413 100644 --- a/modules/juce_gui_basics/native/juce_linux_X11.cpp +++ b/modules/juce_gui_basics/native/juce_linux_X11.cpp @@ -149,7 +149,8 @@ XWindowSystem::~XWindowSystem() noexcept ::Display* XWindowSystem::displayUnref() noexcept { - jassert (display != nullptr); + if (!display) + return display; jassert (displayCount.get() > 0); if (--displayCount == 0) @@ -168,7 +169,7 @@ void XWindowSystem::initialiseXDisplay() noexcept if (display == nullptr) { Logger::outputDebugString ("Failed to connect to the X Server."); - Process::terminate(); + return; } // Create a context to store user data associated with Windows we create @@ -223,6 +224,9 @@ void XWindowSystem::initialiseXDisplay() noexcept void XWindowSystem::destroyXDisplay() noexcept { + if (!display) + return; + ScopedXLock xlock (display); XDestroyWindow (display, juce_messageWindowHandle); juce_messageWindowHandle = 0;