From 846b56c72471f750279a0d60d07443e72f92592d Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 21 Jan 2013 02:31:28 -0500 Subject: Fix defcon timeout timer --- modules/commands/os_defcon.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'modules') diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index d878058e1..c5ee032bd 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -103,12 +103,22 @@ static Anope::string defconReverseModes(const Anope::string &modes); static ServiceReference GlobalService("GlobalService", "Global"); +static Timer *timeout; + class DefConTimeout : public CallBack { int level; public: - DefConTimeout(Module *mod, int newlevel) : CallBack(mod, DConfig.timeout), level(newlevel) { } + DefConTimeout(Module *mod, int newlevel) : CallBack(mod, DConfig.timeout), level(newlevel) + { + timeout = this; + } + + ~DefConTimeout() + { + timeout = NULL; + } void Tick(time_t) anope_override { @@ -133,7 +143,6 @@ class DefConTimeout : public CallBack } } }; -static DefConTimeout *timeout; class CommandOSDefcon : public Command { @@ -196,11 +205,7 @@ class CommandOSDefcon : public Command FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(newLevel)); - if (timeout) - { - delete timeout; - timeout = NULL; - } + delete timeout; if (DConfig.timeout) timeout = new DefConTimeout(this->module, 5); -- cgit