kernwin.i: fixed a reference leak

This commit is contained in:
elias.bachaalany 2009-09-24 10:43:25 +00:00
parent 9f4df6991f
commit 56f6dc02be

View File

@ -196,16 +196,17 @@ uint32 choose_choose(void *self,
int width) int width)
{ {
PyObject *pytitle; PyObject *pytitle;
const char *title;
char deftitle[] = "Choose";
char *title = NULL;
if ((pytitle = PyObject_GetAttrString((PyObject *)self, "title"))) if ((pytitle = PyObject_GetAttrString((PyObject *)self, "title")))
{ {
title = PyString_AsString(pytitle); title = PyString_AsString(pytitle);
} }
else
return choose( {
title = "Choose";
pytitle = NULL;
}
int r = choose(
flags, flags,
x0, y0, x0, y0,
x1, y1, x1, y1,
@ -213,7 +214,7 @@ uint32 choose_choose(void *self,
width, width,
&choose_sizer, &choose_sizer,
&choose_getl, &choose_getl,
title ? title : deftitle, title,
1, 1,
1, 1,
NULL, /* del */ NULL, /* del */
@ -224,7 +225,9 @@ uint32 choose_choose(void *self,
NULL, /* destroy */ NULL, /* destroy */
NULL, /* popup_names */ NULL, /* popup_names */
NULL /* get_icon */ NULL /* get_icon */
); );
Py_XDECREF(pytitle);
return r;
} }
%} %}