From afcd5f2d97591d90a91da63c2eed2a02b325544c Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 22 Oct 2019 16:07:06 -0700 Subject: [PATCH] Keep a reference to the stream passed to wx.FSFile --- etg/filesys.py | 5 +++-- etg/stream.py | 2 +- src/stream_input.cpp | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etg/filesys.py b/etg/filesys.py index 19b32668..c1c410c3 100644 --- a/etg/filesys.py +++ b/etg/filesys.py @@ -67,8 +67,9 @@ def run(): c = module.find('wxFSFile') c.addPrivateCopyCtor() - c.find('wxFSFile.stream').transfer = True - c.find('DetachStream').transferBack = True + c.find('wxFSFile.stream').keepReference = True + #c.find('wxFSFile.stream').transfer = True + #c.find('DetachStream').transferBack = True c = module.find('wxFilterFSHandler') _fixHandlerClass(c) diff --git a/etg/stream.py b/etg/stream.py index 17653eb3..2a353efa 100644 --- a/etg/stream.py +++ b/etg/stream.py @@ -85,7 +85,7 @@ def run(): } // otherwise do the conversion *sipCppPtr = new wxPyInputStream(sipPy); - return sipGetState(sipTransferObj); + return 0; //sipGetState(sipTransferObj); """ # Add Python file-like methods so a wx.InputStream can be used as if it diff --git a/src/stream_input.cpp b/src/stream_input.cpp index b22ca9c6..6f6f6d3b 100644 --- a/src/stream_input.cpp +++ b/src/stream_input.cpp @@ -96,7 +96,6 @@ protected: o = bufsize; memcpy((char*)buffer, PyBytes_AsString(result), o); // strings only, not unicode... Py_DECREF(result); - } else m_lasterror = wxSTREAM_READ_ERROR;