summaryrefslogtreecommitdiffstats
path: root/Modules/_curses_panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_curses_panel.c')
-rw-r--r--Modules/_curses_panel.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 1c7d084..c11f3d8 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -322,6 +322,10 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
static PyObject *
PyCursesPanel_set_panel_userptr(PyCursesPanelObject *self, PyObject *obj)
{
+ PyObject *oldobj;
+ PyCursesInitialised;
+ oldobj = (PyObject *) panel_userptr(self->pan);
+ Py_XDECREF(oldobj);
Py_INCREF(obj);
return PyCursesCheckERR(set_panel_userptr(self->pan, (void*)obj),
"set_panel_userptr");