1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

DemoRunner: Add workaround for crashing desktop session on Ubuntu

The Ubuntu Wayland session crashes completely when adding a system tray
component. This is difficult for us to debug (because the desktop goes
away taking our debug session with it!), so this change just disables
the system tray component on affected platforms.
This commit is contained in:
reuk 2026-01-07 17:56:12 +00:00
parent 457cf9ecef
commit 833b8c329f
No known key found for this signature in database

View file

@ -143,10 +143,6 @@ private:
setContentOwned (new MainComponent(), false);
setVisible (true);
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
taskbarIcon.reset (new DemoTaskbarComponent());
#endif
}
void closeButtonPressed() override { JUCEApplication::getInstance()->systemRequestedQuit(); }
@ -163,7 +159,20 @@ private:
MainComponent& getMainComponent() { return *dynamic_cast<MainComponent*> (getContentComponent()); }
private:
std::unique_ptr<Component> taskbarIcon;
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD
std::unique_ptr<Component> taskbarIcon = std::invoke ([&]() -> std::unique_ptr<Component>
{
// This is a workaround for a bug in the Ubuntu desktop session on Wayland, which
// crashes when adding an X11 system tray entry.
const auto sessionType = SystemStats::getEnvironmentVariable ("XDG_SESSION_TYPE", {});
const auto sessionName = SystemStats::getEnvironmentVariable ("XDG_SESSION_DESKTOP", {});
if (sessionName.equalsIgnoreCase ("ubuntu") && sessionType.equalsIgnoreCase ("wayland"))
return {};
return std::make_unique<DemoTaskbarComponent>();
});
#endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainAppWindow)
};