1
0
mirror of synced 2024-11-08 22:29:16 +00:00

Fixed: double freeing of MonitorForm due to the introduction of the ObjectDictionary

Fixed: FS#2 - Automatically scroll event log
This commit is contained in:
Mark van Renswoude 2014-05-30 13:25:10 +00:00
parent acd998a845
commit 7186a68e1e
2 changed files with 14 additions and 12 deletions

View File

@ -46,7 +46,6 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
List = True
ShowCaptions = True
TabOrder = 0
ExplicitWidth = 350
object tbCopyDetails: TToolButton
Left = 0
Top = 0
@ -69,7 +68,6 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
BevelKind = bkFlat
BevelOuter = bvNone
TabOrder = 1
ExplicitWidth = 350
object HeaderControl1: THeaderControl
Left = 0
Top = 0
@ -83,7 +81,6 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Width = 378
end>
NoSizing = True
ExplicitWidth = 346
end
object reDetails: TRichEdit
Left = 0
@ -113,7 +110,6 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Align = alClient
BevelOuter = bvNone
TabOrder = 1
ExplicitWidth = 634
object vstLog: TVirtualStringTree
Left = 0
Top = 22
@ -138,7 +134,6 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
OnGetImageIndex = vstLogGetImageIndex
OnGetHint = vstLogGetHint
OnInitNode = vstLogInitNode
ExplicitWidth = 634
Columns = <
item
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coShowDropMark, coVisible, coAllowFocus]
@ -168,7 +163,6 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
List = True
ShowCaptions = True
TabOrder = 1
ExplicitWidth = 634
object tbClear: TToolButton
Left = 0
Top = 0
@ -200,7 +194,7 @@ object X2LogObserverMonitorForm: TX2LogObserverMonitorForm
Left = 448
Top = 48
Bitmap = {
494C0101090040008C0010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
494C010109004000940010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000

View File

@ -142,10 +142,10 @@ const
{ TLogEntryNode }
procedure TLogEntryNodeData.Initialize(ALevel: TX2LogLevel; const AMessage: string; ADetails: IX2LogDetails);
begin
Time := Now;
Level := ALevel;
Message := AMessage;
Details := ADetails;
Self.Time := Now;
Self.Level := ALevel;
Self.Message := AMessage;
Self.Details := ADetails;
end;
@ -208,7 +208,7 @@ begin
begin
if FInstances[log] = AForm then
begin
FInstances.Remove(log);
FInstances.ExtractPair(log);
break;
end;
end;
@ -306,13 +306,21 @@ begin
if Log is called from the main thread, or queue it asynchronously }
TThread.Queue(nil,
procedure
var
scroll: Boolean;
begin
if not Paused then
begin
scroll := (vstLog.RootNodeCount > 0) and (vstLog.BottomNode = vstLog.GetLast);
node := vstLog.AddChild(nil);
nodeData := vstLog.GetNodeData(node);
nodeData^.Initialize(ALevel, AMessage, ADetails);
if scroll then
vstLog.ScrollIntoView(node, False);
UpdateUI;
end else
begin