X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33510773054b4e60aeb3715941f7e4faefafe103..c67d60484ba5ad5f4ccc6739d29a0fcf23d20199:/wxPython/src/helpers.cpp diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 715c3e3576..b59f95f5fe 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -561,20 +561,26 @@ wxPyTimer::~wxPyTimer() { } void wxPyTimer::Notify() { - bool doSave = wxPyRestoreThread(); - - PyObject* result; - PyObject* args = Py_BuildValue("()"); + if (!func || func == Py_None) { + wxTimer::Notify(); + } + else { + bool doSave = wxPyRestoreThread(); + + PyObject* result; + PyObject* args = Py_BuildValue("()"); + + result = PyEval_CallObject(func, args); + Py_DECREF(args); + if (result) { + Py_DECREF(result); + PyErr_Clear(); + } else { + PyErr_Print(); + } - result = PyEval_CallObject(func, args); - Py_DECREF(args); - if (result) { - Py_DECREF(result); - PyErr_Clear(); - } else { - PyErr_Print(); + wxPySaveThread(doSave); } - wxPySaveThread(doSave); }