News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Bug in Codecompletion cache

Started by rickg22, January 07, 2006, 07:52:51 PM

Previous topic - Next topic

rickg22

Nativeparser.cpp:465

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

Before:

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


After:

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


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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

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: