View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0019593FPCDatabase Componentspublic2011-06-20 11:052012-05-02 22:09
Reporterizgenov 
Assigned ToJoost van der Sluis 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product VersionProduct Build 
Target VersionFixed in Version2.7.1 
Summary0019593: TBufDataset.SaveToFile crash after delete
Descriptionprocedure TForm1.TestBufDataset;
var
  BufDataset : TBufDataset;
begin
  BufDataset := TBufDataset.Create(self);
  BufDataset.FieldDefs.Add('Field1',ftInteger);
  BufDataset.CreateDataset;
  BufDataset.Active:= true;
  BufDataset.Append;
  BufDataset.FieldValues['Field1'] := 1;
  BufDataset.Post;
  BufDataset.Append;
  BufDataset.FieldValues['Field1'] := 2;
  BufDataset.Post;
  BufDataset.Delete;
  BufDataset.SaveToFile(ExtractFilePath(Application.ExeName) + DirectorySeparator + 'test');
  FreeAndNil(BufDataset)
end;
TagsNo tags attached.
FPCOldBugId0
Fixed in Revision21197
Attached Files? file icon bug19593.pp [^] (528 bytes) 2011-06-20 14:43
diff file icon bufdataset.diff [^] (4,670 bytes) 2012-05-02 07:55 [Show Content]
diff file icon testbufdatasetstreams.pas.diff [^] (3,298 bytes) 2012-05-02 07:56 [Show Content]

- Relationships

-  Notes
(0049230)
Marco van de Voort (manager)
2011-06-20 14:41

Just browsing through and I noticed:

In the first line you say "self" is the owner of tbufdataset (and thus "self") should free it, which it will on form shutdown). But then you free it manually in the last line using freeandnil.

Either use create(nil) or deleted the freeandnil (and I think the first thing is more logical)

Could you also fill in version and operating system information ? Thank you.
(0049231)
Marco van de Voort (manager)
2011-06-20 14:44
edited on: 2011-06-20 15:35

I made a FPC-only demo, and thus this is a FPC bug, not a lazarus bug.

The app still crashes (2.5.1 as of yesterday) when .create is changed to NIL, with the following traceback

D:\testing>bug19593
An unhandled exception occurred at $00434C22 :
EWriteError : Stream write error
  $00434C22 TSTREAM__WRITEBUFFER, line 137 of d:/repo/fpc/rtl/objpas/classes/streams.inc
  $004342B3 TFPCBINARYDATAPACKETREADER__STORERECORD, line 3371 of bufdataset.pas
  $00432A54 STOREUPDATEBUFFER, line 2532 of bufdataset.pas
  $00432889 HANDLEUPDATEBUFFERSFROMRECORD, line 2547 of bufdataset.pas
  $0043275B TCUSTOMBUFDATASET__GETDATASETPACKET, line 2594 of bufdataset.pas
  $00432AF8 TCUSTOMBUFDATASET__SAVETOSTREAM, line 2637 of bufdataset.pas
  $00432542 TCUSTOMBUFDATASET__SAVETOFILE, line 2486 of bufdataset.pas
  $004017FB main, line 17 of bug19593.pp

It works fine if you delete the .delete"

(0059011)
LacaK (reporter)
2012-04-26 12:58
edited on: 2012-04-26 13:29

I can not reproduce with FPC 2.7.1 Win32
Can sb test also?

(0059012)
Marco van de Voort (manager)
2012-04-26 13:12

Still the same with 2.7.1 on linux/x86 from yesterday:

 $080A2422 TSTREAM__WRITEBUFFER, line 196 of /fpc/fpc/rtl/objpas/classes/streams.inc
  $080A0AA3 TFPCBINARYDATAPACKETREADER__STORERECORD, line 3431 of ./fcl-db/src/base/bufdataset.pas
  $0809E824 STOREUPDATEBUFFER, line 2568 of ./fcl-db/src/base/bufdataset.pas
  $0809E659 HANDLEUPDATEBUFFERSFROMRECORD, line 2583 of ./fcl-db/src/base/bufdataset.pas
  $0809E52B TCUSTOMBUFDATASET__GETDATASETPACKET, line 2630 of ./fcl-db/src/base/bufdataset.pas
  $0809E9A8 TCUSTOMBUFDATASET__SAVETOSTREAM, line 2673 of ./fcl-db/src/base/bufdataset.pas
  $0809E2B1 TCUSTOMBUFDATASET__SAVETOFILE, line 2522 of ./fcl-db/src/base/bufdataset.pas
  $08048249 main, line 17 of bug19593.pp
(0059014)
LacaK (reporter)
2012-04-26 13:30
edited on: 2012-05-02 07:54

EDIT: I must correct myself on Win98 it works, on Win Vista is raised exception

(0059179)
LacaK (reporter)
2012-05-02 07:55

* fixed bug when saving update-buffer of new inserted record and afterwards deleted
* more compact fix for bug 18004
* minor code formating, optimization
* +test
(0059196)
Marco van de Voort (manager)
2012-05-02 22:09

Applied, thanks.

- Issue History
Date Modified Username Field Change
2011-06-20 11:05 izgenov New Issue
2011-06-20 14:41 Marco van de Voort Note Added: 0049230
2011-06-20 14:43 Marco van de Voort File Added: bug19593.pp
2011-06-20 14:44 Marco van de Voort Note Added: 0049231
2011-06-20 14:44 Marco van de Voort Project Lazarus => FPC
2011-06-20 14:48 Marco van de Voort FPCOldBugId => 0
2011-06-20 14:48 Marco van de Voort Category Database => Database Components
2011-06-20 14:48 Marco van de Voort Product Version 0.9.30 =>
2011-06-20 14:48 Marco van de Voort Status new => assigned
2011-06-20 14:48 Marco van de Voort Assigned To => Joost van der Sluis
2011-06-20 15:35 Marco van de Voort Note Edited: 0049231
2011-10-01 12:29 Marco van de Voort Status assigned => confirmed
2012-04-26 12:58 LacaK Note Added: 0059011
2012-04-26 13:12 Marco van de Voort Note Added: 0059012
2012-04-26 13:29 LacaK Note Edited: 0059011
2012-04-26 13:30 LacaK Note Added: 0059014
2012-04-26 13:47 LacaK Note Edited: 0059014
2012-05-02 07:54 LacaK Note Edited: 0059014
2012-05-02 07:55 LacaK Note Added: 0059179
2012-05-02 07:55 LacaK File Added: bufdataset.diff
2012-05-02 07:56 LacaK File Added: testbufdatasetstreams.pas.diff
2012-05-02 22:09 Marco van de Voort Fixed in Revision => 21197
2012-05-02 22:09 Marco van de Voort Status confirmed => resolved
2012-05-02 22:09 Marco van de Voort Fixed in Version => 2.7.1
2012-05-02 22:09 Marco van de Voort Resolution open => fixed
2012-05-02 22:09 Marco van de Voort Note Added: 0059196



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker