]> git.stg.codes - stg.git/commitdiff
Full and correct rollback in SMUX::Stop method
authorMaxim Mamontov <faust.madf@gmail.com>
Mon, 12 Sep 2011 08:48:48 +0000 (11:48 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Mon, 12 Sep 2011 08:48:48 +0000 (11:48 +0300)
projects/stargazer/plugins/other/smux/smux.cpp

index fc45fe04e2d15fc93558ba602f8e505e529b0240..bcfc940e432f146a7fffa4e50c4fac1b526600df 100644 (file)
@@ -209,8 +209,6 @@ int SMUX::Stop()
 printfd(__FILE__, "SMUX::Stop() - Before\n");
 running = false;
 
 printfd(__FILE__, "SMUX::Stop() - Before\n");
 running = false;
 
-ResetNotifiers();
-
 if (!stopped)
     {
     //5 seconds to thread stops itself
 if (!stopped)
     {
     //5 seconds to thread stops itself
@@ -236,6 +234,22 @@ if (!stopped)
 
 pthread_join(thread, NULL);
 
 
 pthread_join(thread, NULL);
 
+ResetNotifiers();
+
+    {
+    Tables::iterator it;
+    for (it = tables.begin(); it != tables.end(); ++it)
+        delete it->second;
+    }
+    {
+    Sensors::iterator it;
+    for (it = sensors.begin(); it != sensors.end(); ++it)
+        delete it->second;
+    }
+
+tables.erase(tables.begin(), tables.end());
+sensors.erase(sensors.begin(), sensors.end());
+
 close(sock);
 
 printfd(__FILE__, "SMUX::Stop() - After\n");
 close(sock);
 
 printfd(__FILE__, "SMUX::Stop() - After\n");