[pywin32-checkins] pywin32/win32/src timermodule.cpp,1.3,1.4
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2006-07-12 12:29:20
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30480 Modified Files: timermodule.cpp Log Message: Most of the patch in patch 1495095, to prevent errors should the timer remove itself. Index: timermodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/timermodule.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** timermodule.cpp 26 Jul 2003 14:05:50 -0000 1.3 --- timermodule.cpp 12 Jul 2006 12:29:17 -0000 1.4 *************** *** 30,33 **** --- 30,36 ---- // call the user's function if (callback_function) { + // create a 'death grip' on the callback function, just incase + // the callback itself removes the function from the map. + Py_INCREF(callback_function); PyObject * callback_args = Py_BuildValue ("(il)", (int) event, (long) time); PyObject * result = \ *************** *** 41,44 **** --- 44,48 ---- // everything's ok, return + Py_DECREF(callback_function); Py_XDECREF(callback_args); Py_XDECREF(result); *************** *** 46,51 **** return; } ! // invalid key or callback: remove the key and kill the timer. ! PyDict_DelItem(timer_id_callback_map, py_event); Py_DECREF (py_event); ::KillTimer (NULL, event); --- 50,55 ---- return; } ! // invalid key or callback: kill the timer (note there is no ! // key to remove - we have already determined it is not there!) Py_DECREF (py_event); ::KillTimer (NULL, event); |