diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-26 20:10:03 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-26 20:10:03 +0100 |
commit | 96c7e2cd6d439c7eca9dc1bd31fbb8d80b93af1d (patch) | |
tree | 98dc3cf2a04ffb03e0b08627e41f8121b79e756d /Libraries | |
parent | bc7a9097a780ca8db2321d7127bbfa0f9854339d (diff) | |
download | serenity-96c7e2cd6d439c7eca9dc1bd31fbb8d80b93af1d.zip |
LibGUI: Make a new connection to NotificationServer each time
Since NotificationServer is a spawn-on-demand + die-when-not-used type
of service, we can't expect a singleton connection to it to remain open
and useful.
We solve this for now by making a new IPC connection for every new
notification sent. Maybe there's a better solution for this.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibGUI/Notification.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Libraries/LibGUI/Notification.cpp b/Libraries/LibGUI/Notification.cpp index a06598edd8..f07f056a72 100644 --- a/Libraries/LibGUI/Notification.cpp +++ b/Libraries/LibGUI/Notification.cpp @@ -32,17 +32,10 @@ Notification::~Notification() { } -static NotificationServerConnection& notification_server_connection() -{ - static NotificationServerConnection* connection; - if (!connection) - connection = &NotificationServerConnection::construct().leak_ref(); - return *connection; -} - void Notification::show() { - notification_server_connection().post_message(Messages::NotificationServer::ShowNotification(m_text, m_title)); + auto connection = NotificationServerConnection::construct(); + connection->post_message(Messages::NotificationServer::ShowNotification(m_text, m_title)); } } |