Skip to content

Commit

Permalink
Merged revisions 78635 via svnmerge from
Browse files Browse the repository at this point in the history
svn+ssh://[email protected]/python/trunk

........
  r78635 | victor.stinner | 2010-03-03 22:53:41 +0100 (mer., 03 mars 2010) | 5 lines

  Issue python#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.
........
  • Loading branch information
Victor Stinner committed Mar 3, 2010
1 parent 087ca08 commit a761227
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Modules/_curses_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,24 @@ 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;
}

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);
}

Expand Down

0 comments on commit a761227

Please sign in to comment.