[pywin32-checkins] pywin32/win32/src timermodule.cpp,1.2,1.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-07-26 14:05:53
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv5940 Modified Files: timermodule.cpp Log Message: Plug some reference leaks. Index: timermodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/timermodule.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timermodule.cpp 9 Feb 2001 07:35:55 -0000 1.2 --- timermodule.cpp 26 Jul 2003 14:05:50 -0000 1.3 *************** *** 85,89 **** } ! py_timer_id = Py_BuildValue ("i", (int) timer_id); // associate the timer id with the given callback function --- 85,91 ---- } ! py_timer_id = PyInt_FromLong((long) timer_id); ! if (!py_timer_id) ! return NULL; // associate the timer id with the given callback function *************** *** 92,103 **** callback) == -1) { ::KillTimer (NULL, timer_id); PyErr_SetString (timer_module_error, "internal error, couldn't set timer id callback item"); return NULL; } - Py_INCREF (callback); - // everything went ok. ! return (Py_BuildValue ("i", (int) timer_id)); } --- 94,104 ---- callback) == -1) { ::KillTimer (NULL, timer_id); + Py_DECREF(py_timer_id); PyErr_SetString (timer_module_error, "internal error, couldn't set timer id callback item"); return NULL; } // everything went ok. ! return py_timer_id; } *************** *** 110,114 **** return NULL; } else if (timer_id_callback_map) { ! PyDict_DelItem (timer_id_callback_map, py_timer_id); } int rc; --- 111,117 ---- return NULL; } else if (timer_id_callback_map) { ! if (0 != PyDict_DelItem (timer_id_callback_map, py_timer_id)) { ! return NULL; ! } } int rc; *************** *** 152,155 **** --- 155,159 ---- timer_module_error = PyString_FromString("timer error"); PyDict_SetItemString(dict, "error", timer_module_error); + PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2")); timer_id_callback_map = PyDict_New(); } |