I'm using wxFileSystem to read files in an archive.
To read a file, I obtain a pointer to a wxFSFile using
wxFileSystem::OpenFile().
The wxWidgets docs say that I now own this pointer, but when I try to
delete() it, wxLua says that someone else owns this pointer.
This has a variety of consequences, besides the obvious memory leak.
Most importantly for my application, it leaves the handle to this file
open, and I want to be able to delete the file after I've read it.
Just for completeness sake, this is the function I use to read the
contents of a wxFSFile:
function fs:ReadFile(filename)
local f = self:OpenFile(filename)
if not f then return false end
local stream = f:GetStream()
local t = {}
repeat
local buf = stream:Read(1024)
local last_read = stream:LastRead()
table.insert(t, buf:sub(0, last_read))
until last_read< 1024
-- I'd like to f:delete() here
return table.concat(t)
end
-- Mike
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users