summarylogtreecommitdiffstats
path: root/vdr-favorites-vdr-2.3.1.patch
blob: 4d90b734f461beb51cd75918285e9566f6f66fe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Author: mamomoz
https://www.vdr-portal.de/forum/index.php?thread/127271-announce-vdr-developer-version-2-3-1/&postID=1254875#post1254875

diff -rupN a/favoritechannel.c b/favoritechannel.c
--- a/favoritechannel.c	2011-06-12 18:41:59.000000000 +0200
+++ b/favoritechannel.c	2015-10-22 19:02:55.000000000 +0200
@@ -37,8 +37,8 @@ bool cFavoriteChannel::Save(FILE *f)
 {
    /* Fix crash problem reported by Manuel Hartl    */
    /* when loading a non existing favoriteed channel  */
-   cChannel *channel;
-   channel = Channels.GetByChannelID(GetIndex(), true);
+  LOCK_CHANNELS_READ;
+  const cChannel* channel = Channels->GetByChannelID(GetIndex(), true);
    if (!channel)
    {
       isyslog("Favorite channel '%s' does not exist anymore. Removing\n", *(Index.ToString()) );
@@ -64,17 +64,18 @@ int cFavoriteChannel::Compare(const cLis
    else if (config.sortby == 2)
    {
       /* Sort by same order as channels.conf */
-      if (strcmp(Channels.GetByChannelID(l->Index)->Name(), Channels.GetByChannelID(Index)->Name()) == 0)
+      LOCK_CHANNELS_READ;
+      if (strcmp(Channels->GetByChannelID(l->Index)->Name(), Channels->GetByChannelID(Index)->Name()) == 0)
          return 0;
-      for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel))
+      for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel))
       {
          if (!channel->GroupSep() || *channel->Name())
          {
-            if (!strcmp(channel->Name(), Channels.GetByChannelID(l->Index)->Name()))
+            if (!strcmp(channel->Name(), Channels->GetByChannelID(l->Index)->Name()))
             {
                return 1;
             }
-            else if (!strcmp(channel->Name(), Channels.GetByChannelID(Index)->Name()))
+            else if (!strcmp(channel->Name(), Channels->GetByChannelID(Index)->Name()))
             {
                return -1;
             }
@@ -86,7 +87,8 @@ int cFavoriteChannel::Compare(const cLis
    else if (config.sortby == 3)
    {
       /* Sort by channel name */
-      return strcasecmp( Channels.GetByChannelID(l->Index)->Name(), Channels.GetByChannelID(Index)->Name())*-1;
+      LOCK_CHANNELS_READ;
+      return strcasecmp( Channels->GetByChannelID(l->Index)->Name(), Channels->GetByChannelID(Index)->Name())*-1;
    }
    else
    {
@@ -155,7 +157,8 @@ void cFavoriteChannels::RemoveFavoriteCh
 
 tChannelID cFavoriteChannels::GetCurrentFavorite()
 {
-   cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
+   LOCK_CHANNELS_READ;
+   const cChannel *Channel = Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
    if (Channel)
    {
       tChannelID current_channel = Channel->GetChannelID();
diff -rupN a/favoriteosd.c b/favoriteosd.c
--- a/favoriteosd.c	2011-06-12 19:35:17.000000000 +0200
+++ b/favoriteosd.c	2015-10-22 19:04:37.000000000 +0200
@@ -40,7 +40,8 @@ void cFavoriteOsd::Show()
    ReadFavoriteChannels();
 
    // find the actual current
-   cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
+   LOCK_CHANNELS_READ;
+   const  cChannel *Channel = Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
    if (Channel)
    {
       tChannelID myCurrent = Channel->GetChannelID();
@@ -62,9 +63,10 @@ void cFavoriteOsd::DisplayFavorites()
    Clear();
    for (int i=0; i<number; i++)
    {
-      if (Channels.GetByChannelID(favoritechannels[i]))
+      LOCK_CHANNELS_READ;
+      if (Channels->GetByChannelID(favoritechannels[i]))
       {
-         Add (new cOsdItem((Channels.GetByChannelID(favoritechannels[i]))->Name()));
+         Add (new cOsdItem((Channels->GetByChannelID(favoritechannels[i]))->Name()));
       }
    }
    Display();
@@ -168,7 +170,8 @@ void cFavoriteOsd::CursorOK()
     * If current channel is a favoritered one we remember it as the lastChannel
     */
    lastChannel = FavoriteChannelsList.GetCurrentFavorite();
-   cChannel *Channel =  Channels.GetByChannelID(favoritechannels[current]);
+   LOCK_CHANNELS_READ;
+   const cChannel *Channel = Channels->GetByChannelID(favoritechannels[current]);
    if (Channel)
       cDevice::PrimaryDevice()->SwitchChannel(Channel, true);
 }
@@ -199,7 +202,8 @@ void cFavoriteOsd::AddChannel()
 {
    if (number < CHANNELSMAX)
    {
-      cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
+      LOCK_CHANNELS_READ;
+      const cChannel *Channel = Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
       if (Channel)
       {
          tChannelID Current_channel = Channel->GetChannelID();