Autor Beitrag
GuaAck
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 378
Erhaltene Danke: 32

Windows 8.1
Delphi 10.4 Comm. Edition
BeitragVerfasst: Mo 02.11.09 23:56 
Hallo,

ich erzeuge (Delphi 7) eine Datei mit TFileStream. Nach Abschluss aller WRITES möchte ich eine Checksumme anhängen. Also definiere ich: TCheckFileStream = Class(TFilestream) mit einer Methode 'DESTRUCTOR Free'; dann könnte ich mit dem normalen Schließen mit 'Free' meine laufend berechnete Checksumme anhängen und dann mit 'INHERITED Free' die Datei wirklich schließen.

Das fürhrt aber zu einer 'EAccessViolation', was irgednwie logisch ist, denn ich löse ja eigentlich die Procedure (mein FREE) auf, die gerade ausgeführt wird.

Hat jemand eine Idee, wie das richtig geht?

Gruß Guenther
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: Mo 02.11.09 23:58 
Kannst du bitte ein wenig Code zeigen?

_________________
Wissenschaft schafft Wissenschaft, denn Wissenschaft ist Wissenschaft, die mit Wissen und Schaffen Wissen schafft. (myself)
GuaAck Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 378
Erhaltene Danke: 32

Windows 8.1
Delphi 10.4 Comm. Edition
BeitragVerfasst: Di 03.11.09 19:30 
Hallo, hier ist ein Code-Schnipsel,
Gruß
Günther
=======================================
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
UNIT ucheckfilestream;
INTERFACE

USES Classes, SysUtils;
TYPE
  TCheckFfilestream = CLASS(Tfilestream)
  PUBLIC
    { diverses anderes.... }
    DESTRUCTOR Free;
  END;

IMPLEMENTATION

DESTRUCTOR TCheckFilestream.Free;
BEGIN
  { Aufräumen, Checksumme anfügen, dann: }
  INHERITED Free; { nach Rückkehr hier "Access Violation" }
END;

END.


Moderiert von user profile iconKlabautermann: Delphi-Tags hinzugefügt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 03.11.09 19:32 
Das heißt ja auch destructor Destroy; und nicht Free.