Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 14bc4c45a8bc9c82a391f3e9aea5cb2cf6c6b6e5 Mon Sep 17 00:00:00 2001
- From: tobser <[email protected]>
- Date: Mon, 8 Jul 2013 18:23:21 +0200
- Subject: [PATCH] Prevent creation of additional notification screen
- If an notification update event is queued and immediately after queuing
- the id is unregistered from the notification center an additional screen
- was created because the unregister call removes the screen responsible
- for the current id from m_registrations. Later ProcessQueue is called
- and the screen can not be found and a new one was created.
- This patch searches for screens with matching id which where already
- removed from m_registrations.
- ---
- mythtv/libs/libmythui/mythuinotificationcenter.cpp | 21 +++++++++++++++++++++
- mythtv/libs/libmythui/mythuinotificationcenter.h | 2 ++
- .../libmythui/mythuinotificationcenter_private.h | 3 +++
- 3 files changed, 26 insertions(+)
- diff --git a/mythtv/libs/libmythui/mythuinotificationcenter.cpp b/mythtv/libs/libmythui/mythuinotificationcenter.cpp
- index 3f9b06c..0fe0f5d 100644
- --- a/mythtv/libs/libmythui/mythuinotificationcenter.cpp
- +++ b/mythtv/libs/libmythui/mythuinotificationcenter.cpp
- @@ -642,6 +642,8 @@ void NCPrivate::ProcessQueue(void)
- if (id > 0)
- {
- screen = m_registrations[id];
- + if (!screen)
- + screen = FindNotificationScreen(id);
- }
- if (!screen)
- {
- @@ -688,6 +690,25 @@ void NCPrivate::ProcessQueue(void)
- m_notifications.clear();
- }
- +MythUINotificationScreen* NCPrivate::FindNotificationScreen(int id)
- +{
- + QVector<MythScreenType *> screens;
- + m_screenStack->GetScreenList(screens);
- +
- + for (int i = 0; i < screens.size(); i++)
- + {
- + MythUINotificationScreen *s =
- + dynamic_cast<MythUINotificationScreen*>(screens.at(i));
- + if (s && s->m_id == id)
- + {
- + LOG(VB_GENERAL, LOG_ERR, LOC +
- + QString("Found screen with id %1").arg(id));
- + return s;
- + }
- + }
- + return NULL;
- +}
- +
- /**
- * CreateScreen will create a MythUINotificationScreen instance.
- * This screen will not be displayed until it is used.
- diff --git a/mythtv/libs/libmythui/mythuinotificationcenter.h b/mythtv/libs/libmythui/mythuinotificationcenter.h
- index 9c1e5ae..b2e98da 100644
- --- a/mythtv/libs/libmythui/mythuinotificationcenter.h
- +++ b/mythtv/libs/libmythui/mythuinotificationcenter.h
- @@ -98,6 +98,8 @@ public:
- */
- void ProcessQueue(void);
- +
- +
- private:
- NCPrivate *d;
- diff --git a/mythtv/libs/libmythui/mythuinotificationcenter_private.h b/mythtv/libs/libmythui/mythuinotificationcenter_private.h
- index 923379d..cf98298 100644
- --- a/mythtv/libs/libmythui/mythuinotificationcenter_private.h
- +++ b/mythtv/libs/libmythui/mythuinotificationcenter_private.h
- @@ -102,6 +102,9 @@ public:
- void ScreenStackDeleted(void);
- +
- + MythUINotificationScreen* FindNotificationScreen(int id);
- +
- private:
- MythUINotificationScreen *CreateScreen(MythNotification *notification,
- --
- 1.8.1.5
Advertisement
Add Comment
Please, Sign In to add comment