Commit 47e476c9 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #11217 from dan-masek:fix_issue_11206

parents 814b78da f6e299b5
......@@ -1621,7 +1621,13 @@ static PyObject *pycvSetMouseCallback(PyObject*, PyObject *args, PyObject *kw)
if (param == NULL) {
param = Py_None;
}
ERRWRAP2(setMouseCallback(name, OnMouse, Py_BuildValue("OO", on_mouse, param)));
static PyObject* last_param = NULL;
if (last_param) {
Py_DECREF(last_param);
last_param = NULL;
}
last_param = Py_BuildValue("OO", on_mouse, param);
ERRWRAP2(setMouseCallback(name, OnMouse, last_param));
Py_RETURN_NONE;
}
#endif
......@@ -1657,7 +1663,13 @@ static PyObject *pycvCreateTrackbar(PyObject*, PyObject *args)
PyErr_SetString(PyExc_TypeError, "on_change must be callable");
return NULL;
}
ERRWRAP2(createTrackbar(trackbar_name, window_name, value, count, OnChange, Py_BuildValue("OO", on_change, Py_None)));
static PyObject* last_param = NULL;
if (last_param) {
Py_DECREF(last_param);
last_param = NULL;
}
last_param = Py_BuildValue("OO", on_change, Py_None);
ERRWRAP2(createTrackbar(trackbar_name, window_name, value, count, OnChange, last_param));
Py_RETURN_NONE;
}
......@@ -1705,7 +1717,13 @@ static PyObject *pycvCreateButton(PyObject*, PyObject *args, PyObject *kw)
userdata = Py_None;
}
ERRWRAP2(createButton(button_name, OnButtonChange, Py_BuildValue("OO", on_change, userdata), button_type, initial_button_state != 0));
static PyObject* last_param = NULL;
if (last_param) {
Py_DECREF(last_param);
last_param = NULL;
}
last_param = Py_BuildValue("OO", on_change, userdata);
ERRWRAP2(createButton(button_name, OnButtonChange, last_param, button_type, initial_button_state != 0));
Py_RETURN_NONE;
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment