Keyset Memory Management Bugfix
[pierogi] / pirkeysetmanager.cpp
index 5730ce2..b3ba761 100644 (file)
 #include "keysets/bush.h"
 #include "keysets/cambridge.h"
 #include "keysets/canon.h"
+#include "keysets/changhong.h"
 #include "keysets/cisco.h"
 #include "keysets/compro.h"
 #include "keysets/creative.h"
 #include "keysets/crown.h"
+#include "keysets/crownmustang.h"
 #include "keysets/daewoo.h"
 #include "keysets/dell.h"
 #include "keysets/denon.h"
 #include "keysets/epson.h"
 #include "keysets/fortec.h"
 #include "keysets/foxtel.h"
+#include "keysets/frontech.h"
 #include "keysets/gadmei.h"
 #include "keysets/genius.h"
 #include "keysets/goldstar.h"
 #include "keysets/goodmans.h"
 #include "keysets/grundig.h"
 #include "keysets/haier.h"
+#include "keysets/hantarex.h"
 #include "keysets/harmankardon.h"
 #include "keysets/hauppauge.h"
 #include "keysets/hitachi.h"
@@ -62,6 +66,8 @@
 #include "keysets/kaon.h"
 #include "keysets/kathrein.h"
 #include "keysets/kenwood.h"
+#include "keysets/keymat.h"
+#include "keysets/konka.h"
 #include "keysets/lexuz.h"
 #include "keysets/lg.h"
 #include "keysets/lifetec.h"
 #include "keysets/samsung.h"
 #include "keysets/sanyo.h"
 #include "keysets/sharp.h"
+#include "keysets/sinotec.h"
 #include "keysets/sky.h"
 #include "keysets/sony.h"
 #include "keysets/starsat.h"
 #include "keysets/vizio.h"
 #include "keysets/wd.h"
 #include "keysets/westinghouse.h"
+#include "keysets/wiwa.h"
 #include "keysets/xcruiser.h"
 #include "keysets/yamaha.h"
 #include "keysets/zenith.h"
@@ -152,6 +160,7 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new ADBSTB2(++counter));
   setupKeyset(new ADBSTB3(++counter));
   setupKeyset(new ADBSTB4(++counter));
+  setupKeyset(new ADBSTB5(++counter));
 
   setupKeyset(new AdmiralTV1(++counter));
   setupKeyset(new AdmiralTV2(++counter));
@@ -207,6 +216,12 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new CanonCamcorder1(++counter));
   setupKeyset(new CanonPowershot1(++counter));
 
+  setupKeyset(new ChanghongTV1(++counter));
+  setupKeyset(new ChanghongTV1a(++counter));
+  setupKeyset(new ChanghongTV1b(++counter));
+  setupKeyset(new ChanghongTV2(++counter));
+  setupKeyset(new ChanghongTV3(++counter));
+
   setupKeyset(new CiscoSTB1(++counter));
   setupKeyset(new CiscoSTB2(++counter));
   setupKeyset(new CiscoSTB3(++counter));
@@ -221,6 +236,8 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new CrownTV1(++counter));
   setupKeyset(new CrownAudio1(++counter));
 
+  setupKeyset(new CrownMustangTV1(++counter));
+
   setupKeyset(new DaewooTV1(++counter));
   setupKeyset(new DaewooTV2(++counter));
   setupKeyset(new DaewooTV3(++counter));
@@ -315,6 +332,9 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new FoxtelSTB1(++counter));
   setupKeyset(new FoxtelSTB2(++counter));
 
+  setupKeyset(new FrontechTV1(++counter));
+  setupKeyset(new FrontechTV2(++counter));
+
   setupKeyset(new GadmeiTuner1(++counter));
 
   setupKeyset(new GeniusSpeakers1(++counter));
@@ -348,6 +368,9 @@ PIRKeysetManager::PIRKeysetManager()
 
   setupKeyset(new HaierTV1(++counter));
 
+  setupKeyset(new HantarexTV1(++counter));
+  setupKeyset(new HantarexTV2(++counter));
+
   setupKeyset(new HarmanKardonAmp1(++counter));
   setupKeyset(new HarmanKardonAmp2(++counter));
   setupKeyset(new HarmanKardonReceiver2(++counter));
@@ -425,6 +448,12 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new KenwoodDVD1(++counter));
   setupKeyset(new KenwoodTV1(++counter));
 
+  setupKeyset(new KeymatTV1(++counter));
+  setupKeyset(new KeymatTV2(++counter));
+
+  setupKeyset(new KonkaTV1(++counter));
+  setupKeyset(new KonkaTV2(++counter));
+
   setupKeyset(new LexuzDVB1(++counter));
 
   setupKeyset(new LGTV1(++counter));
@@ -664,6 +693,9 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new SharpReceiver1(++counter));
   setupKeyset(new SharpAC1(++counter));
 
+  setupKeyset(new SinotecTV1(++counter));
+  setupKeyset(new SinotecTV2(++counter));
+
   setupKeyset(new SkyReceiver1(++counter));
   setupKeyset(new SkyReceiver1a(++counter));
 
@@ -671,6 +703,7 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new SonyTV1a(++counter));
   setupKeyset(new SonyTV1b(++counter));
   setupKeyset(new SonyTV1c(++counter));
+  setupKeyset(new SonyTV2(++counter));
   setupKeyset(new SonyAmp1(++counter));
   setupKeyset(new SonyAmp2(++counter));
   setupKeyset(new SonyAudio1(++counter));
@@ -727,6 +760,7 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new ThomsonDVD1(++counter));
   setupKeyset(new ThomsonSat1(++counter));
   setupKeyset(new ThomsonAudio1(++counter));
+  setupKeyset(new ThomsonAudio2(++counter));
 
   setupKeyset(new Tivo1(++counter));
   setupKeyset(new Tivo1a(++counter));
@@ -758,7 +792,9 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new TriaxSTB1(++counter));
   setupKeyset(new TriaxSTB2(++counter));
   setupKeyset(new TriaxSTB2a(++counter));
-//  setupKeyset(new TriaxSTB2b(++counter));
+  setupKeyset(new TriaxSTB3(++counter));
+  setupKeyset(new TriaxSTB3a(++counter));
+  setupKeyset(new TriaxSTB4(++counter));
 
   setupKeyset(new UnitedDVD1(++counter));
   setupKeyset(new UnitedDVBT1(++counter));
@@ -791,6 +827,8 @@ PIRKeysetManager::PIRKeysetManager()
   setupKeyset(new WestinghouseTV1(++counter));
   setupKeyset(new WestinghouseTV2(++counter));
 
+  setupKeyset(new WiwaSTB1(++counter));
+
   setupKeyset(new XcruiserSat1(++counter));
 
   setupKeyset(new YamahaDVD1(++counter));
@@ -823,12 +861,6 @@ PIRKeysetManager::~PIRKeysetManager()
     stopRepeatingFlag = true;
   }
 
-  // Tell the thread that we want it to stop:
-  commandThread.exit();
-
-  // Wait for the thread to stop:
-  commandThread.wait();
-
   // Delete all the keysets:
   PIRKeysetCollection::iterator i = keysetsInfo.begin();
   while (i != keysetsInfo.end())
@@ -836,6 +868,12 @@ PIRKeysetManager::~PIRKeysetManager()
     if ((*i).second) delete (*i).second;
     ++i;
   }
+
+  // Tell the thread that we want it to stop:
+  commandThread.exit();
+
+  // Wait for the thread to stop:
+  commandThread.wait();
 }
 
 
@@ -944,17 +982,17 @@ void PIRKeysetManager::populateKeyset(
 }
 
 
-void PIRKeysetManager::clearKeyset(
+bool PIRKeysetManager::clearKeyset(
   unsigned int keysetID)
 {
   PIRKeysetCollection::iterator i = keysetsInfo.find(keysetID);
 
   if (i == keysetsInfo.end())
   {
-    return; // should throw error or something
+    return true; // best I can do here right now...
   }
 
-  i->second->clearProtocol();
+  return i->second->clearProtocol();
 }