aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Timer.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-05-01 14:47:53 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-05-10 11:00:45 (GMT)
commit4b47675441b76620519b0204497686b09113daaa (patch)
treec3494c61a82b84418761000d5fc7fc5d12188204 /src/FbTk/Timer.cc
parentfa15400cc24ddcfd6e361bd068ae1986b9f9e561 (diff)
downloadfluxbox-4b47675441b76620519b0204497686b09113daaa.zip
fluxbox-4b47675441b76620519b0204497686b09113daaa.tar.bz2
Make RefCount<> more sensible
the previous version of operator*() made no sense. E.g., it violated the invariant (*ptr).foo <=> ptr->foo. The dereferencing operator now returns a reference to the pointed-to object, rather than a pointer to it. I also added a bool conversion operator, which can be used in testing the NULL-ness of the pointer. Anyone wondering if that could be done in a simpler way is encouraged to read <http://www.artima.com/cppsource/safebool.html>. And, finally, I removed the mutable flag from the m_data member, since it does not need it.
Diffstat (limited to 'src/FbTk/Timer.cc')
-rw-r--r--src/FbTk/Timer.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc
index 60df968..cb9ac59 100644
--- a/src/FbTk/Timer.cc
+++ b/src/FbTk/Timer.cc
@@ -98,7 +98,7 @@ void Timer::start() {
98 gettimeofday(&m_start, 0); 98 gettimeofday(&m_start, 0);
99 99
100 // only add Timers that actually DO something 100 // only add Timers that actually DO something
101 if ((! m_timing || m_interval != 0) && *m_handler) { 101 if ((! m_timing || m_interval != 0) && m_handler) {
102 m_timing = true; 102 m_timing = true;
103 addTimer(this); //add us to the list 103 addTimer(this); //add us to the list
104 } 104 }
@@ -121,7 +121,7 @@ void Timer::makeEndTime(timeval &tm) const {
121 121
122 122
123void Timer::fireTimeout() { 123void Timer::fireTimeout() {
124 if (*m_handler) 124 if (m_handler)
125 m_handler->execute(); 125 m_handler->execute();
126} 126}
127 127
@@ -273,7 +273,7 @@ Command<void> *DelayedCmd::parse(const std::string &command,
273 return 0; 273 return 0;
274 274
275 RefCount<Command<void> > cmd(CommandParser<void>::instance().parse(cmd_str, trusted)); 275 RefCount<Command<void> > cmd(CommandParser<void>::instance().parse(cmd_str, trusted));
276 if (*cmd == 0) 276 if (cmd == 0)
277 return 0; 277 return 0;
278 278
279 int delay = 200000; 279 int delay = 200000;