View Issue Details

IDProjectCategoryView StatusLast Update
0033062FPCRTLpublic2018-04-01 09:20
ReporterJohn KozikopoulosAssigned ToMichael Van Canneyt 
Status resolvedResolutionfixed 
PlatformallOSallOS Versionall
Product Version2.6.4Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033062: Missing method FlushBuffer in TFiler and childrent
DescriptionThe abstract method FlushBuffer of the tfiler is missing since the writer and reader classes use a buffered streaming mechanism this creates a number of issues when used.

Encounter on the flashfiller port to fpc unit ffclreng.
Additional InformationDElphi compatibility
TagsNo tags attached.
Fixed in Revision38656
Attached Files


Marco van de Voort

2018-01-22 10:47

manager   ~0106001

binaryObjectwriter already has a flush method. Probably add it to abstract to tfiler and a dummy in reader/writer, and override in writer and reader to call abstractreader/writer.


2018-03-24 09:32

reporter   ~0107385

@John Kozikopoulos

   {$IFnDEF FPC} {original}
    {$ELSE} {freeing the writer apparently flushes the buffer}
      FreeAndNil(Writer); {<-FreeAndNil important so finally Writer.Free is skipped}

Should do what you want.

If you have other questions of this type, post them to the thread started by SunyD on conversion efforts at,34834.0.html?PHPSESSID=6ibv7do64apngvrv9en7k2q881

Where people trying to get that thing working in FPC/lazarus occasionally discuss.

Thaddy de Koning

2018-03-24 13:14

reporter   ~0107390

"FreeAndNil(Writer); {<-FreeAndNil important so finally Writer.Free is skipped}"
If it needs FreeAndNil it is bad code. I can't see that accepted in FPC.


2018-03-25 17:50

reporter   ~0107410

@Thaddy de Koning that's your recurrent ramblings on that subject. I think you don't know what is exactly involved with Free, FreeAndNil.

In the particular context, TFFProxyDatabase.TransactionStartWith the Writer must be flushed before a MemoryStream is used. The only way I found to flush a MemoryStream is to free the Writer. (As mentionned by Marco van de Voort)

In that context FreeAndNil is just PERFECT, it makes the data written with the Writer to be flushed + marks the Writer as Unallocated. Thus in the finally Free will do nothing because the object is nil.

If you can give a single justified reason to give lessons on that point feel free to explain why it is wrong.

Michael Van Canneyt

2018-04-01 09:17

administrator   ~0107495

Implemented. TWriter now overrides it, it is the only place where it can be used.

Issue History

Date Modified Username Field Change
2018-01-22 04:27 John Kozikopoulos New Issue
2018-01-22 10:47 Marco van de Voort Note Added: 0106001
2018-03-23 23:44 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-03-23 23:44 Michael Van Canneyt Status new => assigned
2018-03-24 09:32 BrunoK Note Added: 0107385
2018-03-24 13:14 Thaddy de Koning Note Added: 0107390
2018-03-25 17:50 BrunoK Note Added: 0107410
2018-04-01 09:17 Michael Van Canneyt Fixed in Revision => 38655
2018-04-01 09:17 Michael Van Canneyt Note Added: 0107495
2018-04-01 09:17 Michael Van Canneyt Status assigned => resolved
2018-04-01 09:17 Michael Van Canneyt Fixed in Version => 3.1.1
2018-04-01 09:17 Michael Van Canneyt Resolution open => fixed
2018-04-01 09:17 Michael Van Canneyt Target Version => 3.2.0
2018-04-01 09:20 Michael Van Canneyt Fixed in Revision 38655 => 38656