Patches item #1904119, was opened at 2008-02-28 18:22
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1904119&group_id=51305
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: last released version
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Baldassarre Cesarano (bcesarano)
Assigned to: Nobody/Anonymous (nobody)
Summary: CTB - Avoid some bugs/warnings using timer class
Initial Comment:
I have 2 corrections about CTB - function "timer_fnc" file "Win32/timer.cpp":
1) For avoid crash during desctructor of a timer instance insert the line (the function timer_fnc can be called during destruction!)
I use the class 'timer' to start a routine. At the end routine I (re)start the timer ... recursively.
Everything is fine, but when I need to destroy the object may be a new call to timer_fnc although exitfnc no longer exists (at the moment there is no way to reset the pointer exitfnc after calling to stop().)
Solution:
/*new*/ if (tc->stop)
if(tc->exitfnc) tc->exitfnc(NULL);
if(tc->exitflag) *tc->exitflag = 1;
2) for avoid warnings insert following rows after return;
return;
/*new*/ wxUnusedVar( uTimerID ); // Here just to prevent compiler warnings
/*new*/ wxUnusedVar( uMsg ); // Here just to prevent compiler warnings
/*new*/ wxUnusedVar( dw1 ); // Here just to prevent compiler warnings
/*new*/ wxUnusedVar( dw2 ); // Here just to prevent compiler warnings
};
Then the new routine is:
static void WINAPI timer_fnc(UINT uTimerID,
UINT uMsg,
DWORD_PTR dwUser,
DWORD_PTR dw1,
DWORD_PTR dw2)
{
timer_control *tc = (timer_control*)dwUser;
if (tc->stop)
if(tc->exitfnc) tc->exitfnc(NULL);
if(tc->exitflag) *tc->exitflag = 1;
tc->stop = 0;
return;
wxUnusedVar( uTimerID ); // Here just to prevent compiler warnings
wxUnusedVar( uMsg ); // Here just to prevent compiler warnings
wxUnusedVar( dw1 ); // Here just to prevent compiler warnings
wxUnusedVar( dw2 ); // Here just to prevent compiler warnings
};
I hope that it can be useful
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1904119&group_id=51305
|