Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49069 - sandbox/guigl/boost/guigl/view
From: stipe_at_[hidden]
Date: 2008-09-30 12:26:42


Author: srajko
Date: 2008-09-30 12:26:42 EDT (Tue, 30 Sep 2008)
New Revision: 49069
URL: http://svn.boost.org/trac/boost/changeset/49069

Log:
fixed bug periodic calling derived callback before derived finishing construction
Text files modified:
   sandbox/guigl/boost/guigl/view/periodic.hpp | 8 ++++++--
   1 files changed, 6 insertions(+), 2 deletions(-)

Modified: sandbox/guigl/boost/guigl/view/periodic.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/periodic.hpp (original)
+++ sandbox/guigl/boost/guigl/view/periodic.hpp 2008-09-30 12:26:42 EDT (Tue, 30 Sep 2008)
@@ -34,7 +34,7 @@
     {
         m_enabled = true;
         m_milliseconds = int(seconds * 1000);
- timer_callback();
+ schedule_callback();
     }
     
     void disable()
@@ -42,12 +42,16 @@
         m_enabled = false;
     }
 private:
+ void schedule_callback()
+ {
+ guigl::application::timeout(boost::bind(&periodic::timer_callback, this), m_milliseconds);
+ }
     void timer_callback()
     {
         if(m_enabled)
         {
             static_cast<Derived *>(this)->periodic_callback();
- guigl::application::timeout(boost::bind(&periodic::timer_callback, this), m_milliseconds);
+ schedule_callback();
         }
     }
     bool m_enabled;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk