Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Bug in Codecompletion cache

(1/1)

rickg22:
Nativeparser.cpp:465

The last 1024 bytes never get written because the file's closed prematurely.

Before:

--- Code: ---    wxFileOutputStream fs(f);
    wxBufferedOutputStream fb(fs);
    bool result = parser->WriteToCache(&fb);
    f.Close();

--- End code ---

After:

--- Code: ---    wxFileOutputStream fs(f);
    wxBufferedOutputStream *fb = new wxBufferedOutputStream(fs);
    // write cache file
    bool result = parser->WriteToCache(fb);
    delete fb;
    f.Close();

--- End code ---

I'd commit, but In the middle of a redesign :mrgreen:

killerbot:
how come the dynamic allocation performs ok, and the static one doesn't ??

thomas:
Because the file is explicitely (and unnecessarily) closed. This happens before the stream is destroyed, so the stream is unable to write the last chunk to disk.

rickg22:
oops, i just realized it was I who added that Close() in the first place :oops: - Now i wonder if that close was present in current SVN anyway. :roll:

Navigation

[0] Message Index

Go to full version