Merge remote branch 'remotes/origin/acid-burn/bug_622_swupgrade_networkcheck'
[enigma2.git] / lib / components / file_eraser.cpp
index ea68eb44329bc893a8b3dbdd816ef18d1217b268..9f92fa443012c5dee57090f82c5433ca5e9e29d8 100644 (file)
 eBackgroundFileEraser *eBackgroundFileEraser::instance;
 
 eBackgroundFileEraser::eBackgroundFileEraser()
-       :messages(this,1), stop_thread_timer(this)
+       :messages(this,1), stop_thread_timer(eTimer::create(this))
 {
        if (!instance)
                instance=this;
        CONNECT(messages.recv_msg, eBackgroundFileEraser::gotMessage);
-       CONNECT(stop_thread_timer.timeout, eBackgroundFileEraser::idle);
+       CONNECT(stop_thread_timer->timeout, eBackgroundFileEraser::idle);
 }
 
 void eBackgroundFileEraser::idle()
@@ -29,6 +29,7 @@ eBackgroundFileEraser::~eBackgroundFileEraser()
        messages.send(Message::quit);
        if (instance==this)
                instance=0;
+       kill();  // i dont understand why this is needed .. in ~eThread::eThread is a kill() to..
 }
 
 void eBackgroundFileEraser::thread()
@@ -43,7 +44,7 @@ void eBackgroundFileEraser::thread()
 
        runLoop();
 
-       stop_thread_timer.stop();
+       stop_thread_timer->stop();
 }
 
 void eBackgroundFileEraser::erase(const char *filename)
@@ -51,7 +52,7 @@ void eBackgroundFileEraser::erase(const char *filename)
        if (filename)
        {
                char buf[255];
-               snprintf(buf, 255, "%s.$$$", filename);
+               snprintf(buf, 255, "%s.del", filename);
                if (rename(filename, buf)<0)
                        ;/*perror("rename file failed !!!");*/
                else
@@ -75,7 +76,7 @@ void eBackgroundFileEraser::gotMessage(const Message &msg )
                                        eDebug("file %s erased", msg.filename);
                                free((char*)msg.filename);
                        }
-                       stop_thread_timer.start(1000, true); // stop thread in one seconds
+                       stop_thread_timer->start(1000, true); // stop thread in one seconds
                        break;
                case Message::quit:
                        quit(0);