diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-03 21:56:53 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-03 21:56:53 (GMT) |
commit | a761227ae0595062897c3dfacfa01b8ed026288e (patch) | |
tree | 65e1db18b7828d23c57967b531c067a24a324e2e /Modules | |
parent | 087ca08f002f7898ee433079ceee796bf86fd75f (diff) | |
download | cpython-a761227ae0595062897c3dfacfa01b8ed026288e.zip cpython-a761227ae0595062897c3dfacfa01b8ed026288e.tar.gz cpython-a761227ae0595062897c3dfacfa01b8ed026288e.tar.bz2 |
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.
........
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_curses_panel.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index 02e064f..ff1276d 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo) po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type); if (po == NULL) return NULL; po->pan = pan; - po->wo = wo; - Py_INCREF(wo); if (insert_lop(po) < 0) { - PyObject_DEL(po); + po->wo = NULL; + Py_DECREF(po); return NULL; } + po->wo = wo; + Py_INCREF(wo); return (PyObject *)po; } @@ -191,8 +192,10 @@ static void PyCursesPanel_Dealloc(PyCursesPanelObject *po) { (void)del_panel(po->pan); - Py_DECREF(po->wo); - remove_lop(po); + if (po->wo != NULL) { + Py_DECREF(po->wo); + remove_lop(po); + } PyObject_DEL(po); } |