diff --git a/src/Wt/WTimer.C b/src/Wt/WTimer.C index bbea3ae6d8..609bd4ee9f 100644 --- a/src/Wt/WTimer.C +++ b/src/Wt/WTimer.C @@ -17,13 +17,13 @@ namespace Wt { WTimer::WTimer() : uTimerWidget_(new WTimerWidget(this)), - singleShot_(false), interval_(0), + singleShot_(false), active_(false), - timeoutConnected_(false), timeout_(new Time()) { timerWidget_ = uTimerWidget_.get(); + timeout().connect(this, &WTimer::gotTimeout); } EventSignal& WTimer::timeout() @@ -63,11 +63,6 @@ void WTimer::start() !timeout().isExposedSignal()); timerWidget_->timerStart(jsRepeat); - - if (!timeoutConnected_) { - timeout().connect(this, &WTimer::gotTimeout); - timeoutConnected_ = true; - } } void WTimer::stop() diff --git a/src/Wt/WTimer.h b/src/Wt/WTimer.h index 4f8cd67e1f..2cc67232db 100644 --- a/src/Wt/WTimer.h +++ b/src/Wt/WTimer.h @@ -153,10 +153,9 @@ class WT_API WTimer : public WObject observing_ptr timerWidget_; std::unique_ptr uTimerWidget_; - bool singleShot_; std::chrono::milliseconds interval_; + bool singleShot_; bool active_; - bool timeoutConnected_; std::unique_ptr