Merged revisions 78635 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78635 | victor.stinner | 2010-03-03 22:53:41 +0100 (mer., 03 mars 2010) | 5 lines Issue #3299: fix curses.panel.new_panel() error handler, replace PyObject_DEL() by Py_DECREF() to avoid a crash in pydebug mode. Use po->wo==NULL to detect than the panel is in the lop list or not. ........
This commit is contained in:
parent
087ca08f00
commit
a761227ae0
|
@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||||
if (po == NULL) return NULL;
|
if (po == NULL) return NULL;
|
||||||
po->pan = pan;
|
po->pan = pan;
|
||||||
po->wo = wo;
|
|
||||||
Py_INCREF(wo);
|
|
||||||
if (insert_lop(po) < 0) {
|
if (insert_lop(po) < 0) {
|
||||||
PyObject_DEL(po);
|
po->wo = NULL;
|
||||||
|
Py_DECREF(po);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
po->wo = wo;
|
||||||
|
Py_INCREF(wo);
|
||||||
return (PyObject *)po;
|
return (PyObject *)po;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,8 +192,10 @@ static void
|
||||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||||
{
|
{
|
||||||
(void)del_panel(po->pan);
|
(void)del_panel(po->pan);
|
||||||
Py_DECREF(po->wo);
|
if (po->wo != NULL) {
|
||||||
remove_lop(po);
|
Py_DECREF(po->wo);
|
||||||
|
remove_lop(po);
|
||||||
|
}
|
||||||
PyObject_DEL(po);
|
PyObject_DEL(po);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue