[Lazarus] DateTimeToStr gives an invalid format string error when closing an rdp session
Luca Olivetti
luca at wetron.es
Tue Jan 24 23:55:01 CET 2017
El 24/01/17 a les 22:34, Mattias Gaertner via Lazarus ha escrit:
> On Tue, 24 Jan 2017 19:24:35 +0100
> Luca Olivetti via Lazarus <lazarus at lists.lazarus-ide.org> wrote:
>
>> [...]
>> #0 fpc_raiseexception at :0
>> #1
>> SYSUTILS_DATETIMETOSTRING$crc782201FE_STOREFORMAT$ANSISTRING$LONGINT$BOOLEAN
>> at :0
>> #2
>> SYSUTILS_DATETIMETOSTRING$crc782201FE_STOREFORMAT$ANSISTRING$LONGINT$BOOLEAN
>> at :0
>> #3
>> SYSUTILS_DATETIMETOSTRING$ANSISTRING$ANSISTRING$TDATETIME$TFORMATSETTINGS
>> at :0
>> #4 SYSUTILS_DATETIMETOSTRING$ANSISTRING$ANSISTRING$TDATETIME at :0
>> #5 SYSUTILS_DATETIMETOSTR$TDATETIME$$ANSISTRING at :0
>> #6 TLOGGER__INTERNALLOG(0x1eab2390 '127.0.0.1:57233 Nueva
>> conexi'#195#179'n desde 127.0.0.1:57233', <error reading variable>) at
>> D:\boda_t10_l1_pc\comun\utils.pas:149
>> #7 TLOGGER__LOG(0x1eab2390 '127.0.0.1:57233 Nueva conexi'#195#179'n
>> desde 127.0.0.1:57233', <error reading variable>) at
>> D:\boda_t10_l1_pc\comun\utils.pas:190
>
> Start searching for the bug in TLOGGER.LOG.
I don't see it (FMemo is a TSynEdit, anyway it bombs in the call to
DateTimeToStr). Besides, I don't see the relation with opening or
closing an RDP connection to the virtual machine (there should be plenty
of calls to CheckSynchronize at any other time and they don't trigger
this bug)
procedure TLogger.Log(const m: string);
begin
if m=FLastMsg then
begin
Repeated(false);
end else
begin
Repeated(true);
FLastMsg:=m;
InternalLog(m); <---took this branch
end;
end;
procedure TLogger.InternalLog(const m: string);
var final:boolean;
begin
//check if at the end of the log
final:=FMemo.topline>FMemo.Lines.Count-FMemo.LinesInWindow;
FMemo.lines.BeginUpdate;
if FMemo.lines.count>5000 then
FMemo.lines.delete(0);
Fmemo.lines.add(DateTimeToStr(now)+' '+m); <---exception triggered here
FMemo.lines.EndUpdate;
//if we wer at the end scroll to keep the new line visible
if final then
FMemo.TopLine:=FMemo.Lines.Count-FMemo.LinesInWindow+1;
FLogFile.Log(m);
end;
procedure TLogger.Repeated(clear:boolean);
begin
if not clear then
FLastMsgCount:=FLastMsgCount+1;
if (clear and (FLastMsgCount>0)) or (not clear and (FLastMsgCount mod
100 = 0)) then
InternalLog(format('last message repeated %d times', [FLastMsgCount]));
if clear then
FLastMsgCount:=0;
end;
Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007
More information about the Lazarus
mailing list