]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Timeout.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / Timeout.C
index 114d88aa3fd765eba52e0ca82a0c459e9a26ff54..99ee026f82cbed1be3686c35fdcd1eb329b17cc2 100644 (file)
@@ -1,34 +1,22 @@
 /**
  * \file Timeout.C
- * Copyright 2001 LyX Team
- * Read COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Lars Gullik Bjønnes
  * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
  */
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include <config.h>
 
 #include "Timeout.h"
-#include "debug.h"
-
-#include "Timeout_pimpl.h"
-
-
-Timeout::Timeout(unsigned int msec, Type t)
-       : type(t), timeout_ms(msec)
-{
-       pimpl_ = new Pimpl(this);
-}
 
 
 Timeout::~Timeout()
 {
        pimpl_->stop();
-       delete pimpl_;
 }
 
 
@@ -43,25 +31,29 @@ void Timeout::start()
        pimpl_->start();
 }
 
+
 void Timeout::stop()
 {
        pimpl_->stop();
 }
 
+
 void Timeout::restart()
 {
        pimpl_->stop();
        pimpl_->start();
 }
 
+
 void Timeout::emit()
 {
        pimpl_->reset();
-       timeout.emit();
+       timeout();
        if (type == CONTINUOUS)
                pimpl_->start();
 }
 
+
 Timeout & Timeout::setType(Type t)
 {
        type = t;
@@ -71,6 +63,9 @@ Timeout & Timeout::setType(Type t)
 
 Timeout & Timeout::setTimeout(unsigned int msec)
 {
+       // Can't have a timeout of zero!
+       BOOST_ASSERT(msec);
+
        timeout_ms = msec;
        return * this;
 }