Autor Beitrag
winx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Do 25.08.05 17:37 
Hallo,

wie kann ich in einer VST alle Nodes mit allen zugehörigen Datenelement zuverlässig löschen
und denn Speicher wieder freigeben?
Langt dazu VST.clear??? oder muß ich noch etwas extra machen???

Danke
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 26.08.05 02:07 
Sind deine "Datenelemente" Zeiger auf Record-Strukturen die du mit New oder GetMem selber angelegt hast oder Klassen?

_________________
Ciao, Sprint.
winx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Fr 26.08.05 06:46 
Hallo,

eines meiner Datenelemente sieht so aus (es sind Klassen-Objkete, die ich aus einer Liste bekomme und danach auch wieder benötige)

Bsp:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
type
  PVSTData = ^TVSTData;
  TVSTData = record
     nr     : integer;
     action : TAction;//wird diese Klasse beim anlegen mit 'add' als Zeiger oder Kopie an die VST übergeben?
     Color  : TColor;
  end;


Wie und was muß/kann ich da freigeben? Die TAction, benötige ich danach wieder...

danke

Moderiert von user profile iconAXMD: Delphi-Tags hinzugefügt.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 26.08.05 06:51 
Übergibst du eine Variable des Typs TVSTData, einen Zeiger auf eine Variable des Typs TVSTData oder eine Variable des Typs PVSTData?

AXMD
winx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Fr 26.08.05 07:15 
ich füge es so hinzu:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
procedure TActionFrameController.initNewData();
var i :integer;
    Node : PVirtualNode;
    pvst : PVSTData;
    Color: Boolean;
begin

  Color:=False;
  //Zuerst die  TreeView leeren
  m_ActionFrame.VSTActionGroup.Clear;

  //Danach wieder füllen
  m_ActionFrame.VSTActionGroup.BeginUpdate;
  m_ActionFrame.VSTActionGroup.NodeDataSize := SizeOf(TVSTData);

  for i:= 0 to m_currentSelectedActionGroup.ActionList.Count-1 do begin

      node := m_ActionFrame.VSTActionGroup.AddChild(nil);
      pvst := m_ActionFrame.VSTActionGroup.GetNodeData(node);
      pvst^.nr := i+1;
      pvst^.action := TAction(m_currentSelectedActionGroup.ActionList[i]);
      if not Color then begin
       pvst^.Color:=clwhite
       end
       else pvst^.Color:=$70AAFFFF;

  end;

  m_ActionFrame.VSTActionGroup.EndUpdate;

end;


Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt.
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Fr 26.08.05 09:46 
Hallo,

m_ActionFrame.VSTActionGroup.Clear; ist ausreichend, da Du nur die Referenz der Aktion übergibst.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)