Guest User

Untitled

a guest
Jul 8th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.06 KB | None | 0 0
  1.  
  2. From 14bc4c45a8bc9c82a391f3e9aea5cb2cf6c6b6e5 Mon Sep 17 00:00:00 2001
  3. From: tobser <[email protected]>
  4. Date: Mon, 8 Jul 2013 18:23:21 +0200
  5. Subject: [PATCH] Prevent creation of additional notification screen
  6.  
  7. If an notification update event is queued and immediately after queuing
  8. the id is unregistered from the notification center an additional screen
  9. was created because the unregister call removes the screen responsible
  10. for the current id from m_registrations. Later ProcessQueue is called
  11. and the screen can not be found and a new one was created.
  12.  
  13. This patch searches for screens with matching id which where already
  14. removed from m_registrations.
  15. ---
  16. mythtv/libs/libmythui/mythuinotificationcenter.cpp  | 21 +++++++++++++++++++++
  17.  mythtv/libs/libmythui/mythuinotificationcenter.h    |  2 ++
  18.  .../libmythui/mythuinotificationcenter_private.h    |  3 +++
  19.  3 files changed, 26 insertions(+)
  20.  
  21. diff --git a/mythtv/libs/libmythui/mythuinotificationcenter.cpp b/mythtv/libs/libmythui/mythuinotificationcenter.cpp
  22. index 3f9b06c..0fe0f5d 100644
  23. --- a/mythtv/libs/libmythui/mythuinotificationcenter.cpp
  24. +++ b/mythtv/libs/libmythui/mythuinotificationcenter.cpp
  25. @@ -642,6 +642,8 @@ void NCPrivate::ProcessQueue(void)
  26.          if (id > 0)
  27.          {
  28.              screen = m_registrations[id];
  29. +            if (!screen)
  30. +                screen = FindNotificationScreen(id);
  31.          }
  32.          if (!screen)
  33.          {
  34. @@ -688,6 +690,25 @@ void NCPrivate::ProcessQueue(void)
  35.      m_notifications.clear();
  36.  }
  37.  
  38. +MythUINotificationScreen* NCPrivate::FindNotificationScreen(int id)
  39. +{
  40. +    QVector<MythScreenType *> screens;
  41. +    m_screenStack->GetScreenList(screens);
  42. +
  43. +    for (int i = 0; i < screens.size(); i++)
  44. +    {
  45. +        MythUINotificationScreen *s =
  46. +            dynamic_cast<MythUINotificationScreen*>(screens.at(i));
  47. +        if (s && s->m_id == id)
  48. +        {
  49. +           LOG(VB_GENERAL, LOG_ERR, LOC +
  50. +                    QString("Found screen with id %1").arg(id));
  51. +            return s;
  52. +        }
  53. +    }
  54. +    return NULL;
  55. +}
  56. +
  57.  /**
  58.   * CreateScreen will create a MythUINotificationScreen instance.
  59.   * This screen will not be displayed until it is used.
  60. diff --git a/mythtv/libs/libmythui/mythuinotificationcenter.h b/mythtv/libs/libmythui/mythuinotificationcenter.h
  61. index 9c1e5ae..b2e98da 100644
  62. --- a/mythtv/libs/libmythui/mythuinotificationcenter.h
  63. +++ b/mythtv/libs/libmythui/mythuinotificationcenter.h
  64. @@ -98,6 +98,8 @@ public:
  65.       */
  66.      void ProcessQueue(void);
  67.  
  68. +
  69. +
  70.  private:
  71.      NCPrivate *d;
  72.  
  73. diff --git a/mythtv/libs/libmythui/mythuinotificationcenter_private.h b/mythtv/libs/libmythui/mythuinotificationcenter_private.h
  74. index 923379d..cf98298 100644
  75. --- a/mythtv/libs/libmythui/mythuinotificationcenter_private.h
  76. +++ b/mythtv/libs/libmythui/mythuinotificationcenter_private.h
  77. @@ -102,6 +102,9 @@ public:
  78.  
  79.      void ScreenStackDeleted(void);
  80.  
  81. +
  82. +    MythUINotificationScreen* FindNotificationScreen(int id);
  83. +
  84.  private:
  85.  
  86.      MythUINotificationScreen *CreateScreen(MythNotification *notification,
  87. --
  88. 1.8.1.5
Advertisement
Add Comment
Please, Sign In to add comment