From 8af26133d9906216890eecf33fd47186d9e5b76d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 20 Nov 2001 07:40:26 +0000 Subject: [PATCH] Bug fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/helpers.cpp | 2 +- wxPython/src/misc2.i | 8 ++++---- wxPython/src/msw/misc2.cpp | 15 +++++++++------ wxPython/src/msw/misc2.py | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 187a0673c8..9c4cb6ecda 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -1306,7 +1306,7 @@ PyObject* wxArrayString2PyList_helper(const wxArrayString& arr) { for (size_t i=0; i < arr.GetCount(); i++) { PyObject* str = PyString_FromString(arr[i].c_str()); PyList_Append(list, str); - // TODO: Check refcount on str... + Py_DECREF(str); } return list; } diff --git a/wxPython/src/misc2.i b/wxPython/src/misc2.i index 9da8e9f530..1e11812c29 100644 --- a/wxPython/src/misc2.i +++ b/wxPython/src/misc2.i @@ -347,8 +347,8 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc public: wxPyFontEnumerator(); ~wxPyFontEnumerator(); - void _setCallbackInfo(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator)" + void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator, 0)" bool EnumerateFacenames( wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all @@ -360,12 +360,12 @@ public: %addmethods { PyObject* GetEncodings() { wxArrayString* arr = self->GetEncodings(); - return wxArrayString2PyList_helper(arr); + return wxArrayString2PyList_helper(*arr); } PyObject* GetFacenames() { wxArrayString* arr = self->GetFacenames(); - return wxArrayString2PyList_helper(arr); + return wxArrayString2PyList_helper(*arr); } } }; diff --git a/wxPython/src/msw/misc2.cpp b/wxPython/src/msw/misc2.cpp index 0d19b32cbe..b7a854bdaa 100644 --- a/wxPython/src/msw/misc2.cpp +++ b/wxPython/src/msw/misc2.cpp @@ -3037,19 +3037,21 @@ static PyObject *_wrap_delete_wxFontEnumerator(PyObject *self, PyObject *args, P return _resultobj; } -#define wxFontEnumerator__setCallbackInfo(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setCallbackInfo(_swigarg0,_swigarg1)) +#define wxFontEnumerator__setCallbackInfo(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->_setCallbackInfo(_swigarg0,_swigarg1,_swigarg2)) static PyObject *_wrap_wxFontEnumerator__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyFontEnumerator * _arg0; PyObject * _arg1; PyObject * _arg2; + bool _arg3; PyObject * _argo0 = 0; PyObject * _obj1 = 0; PyObject * _obj2 = 0; - char *_kwnames[] = { "self","self","_class", NULL }; + int tempbool3; + char *_kwnames[] = { "self","self","_class","incref", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxFontEnumerator__setCallbackInfo",_kwnames,&_argo0,&_obj1,&_obj2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOi:wxFontEnumerator__setCallbackInfo",_kwnames,&_argo0,&_obj1,&_obj2,&tempbool3)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3064,9 +3066,10 @@ static PyObject *_wrap_wxFontEnumerator__setCallbackInfo(PyObject *self, PyObjec { _arg2 = _obj2; } + _arg3 = (bool ) tempbool3; { wxPy_BEGIN_ALLOW_THREADS; - wxFontEnumerator__setCallbackInfo(_arg0,_arg1,_arg2); + wxFontEnumerator__setCallbackInfo(_arg0,_arg1,_arg2,_arg3); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -3135,7 +3138,7 @@ static PyObject *_wrap_wxFontEnumerator_EnumerateEncodings(PyObject *self, PyObj static PyObject * wxPyFontEnumerator_GetEncodings(wxPyFontEnumerator *self) { wxArrayString* arr = self->GetEncodings(); - return wxArrayString2PyList_helper(arr); + return wxArrayString2PyList_helper(*arr); } static PyObject *_wrap_wxFontEnumerator_GetEncodings(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -3167,7 +3170,7 @@ static PyObject *_wrap_wxFontEnumerator_GetEncodings(PyObject *self, PyObject *a static PyObject * wxPyFontEnumerator_GetFacenames(wxPyFontEnumerator *self) { wxArrayString* arr = self->GetFacenames(); - return wxArrayString2PyList_helper(arr); + return wxArrayString2PyList_helper(*arr); } static PyObject *_wrap_wxFontEnumerator_GetFacenames(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; diff --git a/wxPython/src/msw/misc2.py b/wxPython/src/msw/misc2.py index cfc0d4b3aa..f8be3794cb 100644 --- a/wxPython/src/msw/misc2.py +++ b/wxPython/src/msw/misc2.py @@ -123,7 +123,7 @@ class wxFontEnumerator(wxFontEnumeratorPtr): def __init__(self,*_args,**_kwargs): self.this = apply(misc2c.new_wxFontEnumerator,_args,_kwargs) self.thisown = 1 - self._setCallbackInfo(self, wxFontEnumerator) + self._setCallbackInfo(self, wxFontEnumerator, 0) -- 2.45.2