Correctly handle the release of ownership of the wx.FSFile returned

from wx.FileSystemHandler.OpenFile.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-06-13 22:25:33 +00:00
parent f2f8871a2e
commit e2e2649fab
2 changed files with 17 additions and 13 deletions

View File

@@ -1673,6 +1673,8 @@ extern wxPyApp *wxPythonApp;
obj, s)); \ obj, s)); \
if (ro) { \ if (ro) { \
wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \ wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
/* release ownership of the C++ wx.FSFile object. */ \
PyObject_SetAttrString(ro, "thisown", Py_False); \
Py_DECREF(ro); \ Py_DECREF(ro); \
} \ } \
Py_DECREF(obj); \ Py_DECREF(obj); \

View File

@@ -26,13 +26,15 @@
class wxFSFile : public wxObject class wxFSFile : public wxObject
{ {
public: public:
%pythonAppend wxFSFile %typemap(out) wxFSFile*; // turn off this typemap
"self.thisown = 0 # It will normally be deleted by the user of the wx.FileSystem";
wxFSFile(wxInputStream *stream, const wxString& loc, wxFSFile(wxInputStream *stream, const wxString& loc,
const wxString& mimetype, const wxString& anchor, const wxString& mimetype, const wxString& anchor,
wxDateTime modif); wxDateTime modif);
// Turn it back on.
%typemap(out) wxFSFile* { $result = wxPyMake_wxObject($1, $owner); }
~wxFSFile(); ~wxFSFile();
wxInputStream *GetStream(); wxInputStream *GetStream();