mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
NotificationServer: Close connection on notification close
When the notification was closed, the connection was kept around. This caused the core event loop to take up nearly all CPU, so instead of checking the connection we clear it on close and add state variables to check state.
This commit is contained in:
parent
9d09594e44
commit
ddcef0452a
2 changed files with 33 additions and 12 deletions
|
@ -36,6 +36,8 @@ class NotificationServerConnection;
|
|||
class Notification : public Core::Object {
|
||||
C_OBJECT(Notification);
|
||||
|
||||
friend class NotificationServerConnection;
|
||||
|
||||
public:
|
||||
virtual ~Notification() override;
|
||||
|
||||
|
@ -64,9 +66,13 @@ public:
|
|||
bool update();
|
||||
void close();
|
||||
|
||||
bool is_showing() const { return m_shown && !m_destroyed; }
|
||||
|
||||
private:
|
||||
Notification();
|
||||
|
||||
void connection_closed();
|
||||
|
||||
String m_title;
|
||||
bool m_title_dirty;
|
||||
String m_text;
|
||||
|
@ -74,6 +80,8 @@ private:
|
|||
RefPtr<Gfx::Bitmap> m_icon;
|
||||
bool m_icon_dirty;
|
||||
|
||||
bool m_destroyed { false };
|
||||
bool m_shown { false };
|
||||
RefPtr<NotificationServerConnection> m_connection;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue