mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 16:00:16 +02:00
MG: fixed synedit crash on exit
git-svn-id: trunk@1476 -
This commit is contained in:
parent
2e084658ef
commit
8e4ae5f28d
@ -1371,7 +1371,7 @@ function TCodeToolManager.OnGetCodeToolForBuffer(Sender: TObject;
|
|||||||
begin
|
begin
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('[TCodeToolManager.OnGetCodeToolForBuffer]'
|
writeln('[TCodeToolManager.OnGetCodeToolForBuffer]'
|
||||||
,' Sender=',TCustomCodeTool(Sender).Scanner.MainSource.Filename
|
,' Sender=',TCustomCodeTool(Sender).MainFilename
|
||||||
,' Code=',Code.Filename);
|
,' Code=',Code.Filename);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result:=TFindDeclarationTool(GetCodeToolForSource(Code,true));
|
Result:=TFindDeclarationTool(GetCodeToolForSource(Code,true));
|
||||||
|
@ -108,7 +108,7 @@ function UpperCaseStr(const s: string): string;
|
|||||||
var i, l: integer;
|
var i, l: integer;
|
||||||
begin
|
begin
|
||||||
l:=length(s);
|
l:=length(s);
|
||||||
Setlength(Result,l);
|
SetLength(Result,l);
|
||||||
for i:=1 to l do
|
for i:=1 to l do
|
||||||
Result[i]:=UpChars[s[i]];
|
Result[i]:=UpChars[s[i]];
|
||||||
end;
|
end;
|
||||||
|
@ -477,6 +477,7 @@ var
|
|||||||
c1, c2: char;
|
c1, c2: char;
|
||||||
begin
|
begin
|
||||||
// Skip all spaces and comments
|
// Skip all spaces and comments
|
||||||
|
//writeln(' TLinkScanner.ReadNextToken SrcPos=',SrcPos,' SrcLen=',SrcLen,' "',copy(Src,SrcPos,5),'" "',copy(UpperSrc,SrcPos,5),'"');
|
||||||
if (SrcPos>SrcLen) then ReturnFromIncludeFile;
|
if (SrcPos>SrcLen) then ReturnFromIncludeFile;
|
||||||
while SrcPos<=SrcLen do begin
|
while SrcPos<=SrcLen do begin
|
||||||
if IsCommentStartChar[Src[SrcPos]] then begin
|
if IsCommentStartChar[Src[SrcPos]] then begin
|
||||||
@ -625,10 +626,11 @@ writeln('TLinkScanner.Scan C ',SrcLen);
|
|||||||
LastTokenIsEqual:=false;
|
LastTokenIsEqual:=false;
|
||||||
LastTokenIsEnd:=false;
|
LastTokenIsEnd:=false;
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TLinkScanner.Scan A ',SrcLen);
|
writeln('TLinkScanner.Scan D ',SrcLen);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
repeat
|
repeat
|
||||||
ReadNextToken;
|
ReadNextToken;
|
||||||
|
//writeln('TLinkScanner.Scan E "',copy(Src,TokenStart,SrcPos-TokenStart),'"');
|
||||||
UpdateCleanedSource(SrcPos-1);
|
UpdateCleanedSource(SrcPos-1);
|
||||||
if (SrcPos<=SrcLen+1) then begin
|
if (SrcPos<=SrcLen+1) then begin
|
||||||
if (not LastTokenIsEqual) and
|
if (not LastTokenIsEqual) and
|
||||||
|
@ -432,9 +432,17 @@ procedure TheFontsInfoManager.UnlockFontsInfo(
|
|||||||
begin
|
begin
|
||||||
with pFontsInfo^ do
|
with pFontsInfo^ do
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
if LockCount>0 then begin
|
||||||
|
Dec(LockCount);
|
||||||
|
if 0 = LockCount then
|
||||||
|
DestroyFontHandles(pFontsInfo);
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
Dec(LockCount);
|
Dec(LockCount);
|
||||||
if 0 = LockCount then
|
if 0 = LockCount then
|
||||||
DestroyFontHandles(pFontsInfo);
|
DestroyFontHandles(pFontsInfo);
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -531,6 +539,12 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
if SynTextDrawerFinalization and (FFontsInfo.Count=0) then
|
||||||
|
// the program is in the finalization phase
|
||||||
|
// and this object is not used anymore -> destroy it
|
||||||
|
Free;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TheFontsInfoManager.RetrieveLogFontForComparison(ABaseFont: TFont;
|
procedure TheFontsInfoManager.RetrieveLogFontForComparison(ABaseFont: TFont;
|
||||||
@ -639,7 +653,6 @@ end;
|
|||||||
|
|
||||||
constructor TheFontStock.Create(InitialFont: TFont);
|
constructor TheFontStock.Create(InitialFont: TFont);
|
||||||
begin
|
begin
|
||||||
writeln(' AAA TheFontStock.Create Self=',HexStr(Cardinal(Self),8));
|
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
SetBaseFont(InitialFont);
|
SetBaseFont(InitialFont);
|
||||||
@ -647,8 +660,6 @@ end;
|
|||||||
|
|
||||||
destructor TheFontStock.Destroy;
|
destructor TheFontStock.Destroy;
|
||||||
begin
|
begin
|
||||||
writeln(' AAA TheFontStock.Destroy Self=',HexStr(Cardinal(Self),8));
|
|
||||||
|
|
||||||
ReleaseFontsInfo;
|
ReleaseFontsInfo;
|
||||||
ASSERT(FDCRefCount = 0);
|
ASSERT(FDCRefCount = 0);
|
||||||
|
|
||||||
@ -745,8 +756,6 @@ end;
|
|||||||
|
|
||||||
procedure TheFontStock.ReleaseFontsInfo;
|
procedure TheFontStock.ReleaseFontsInfo;
|
||||||
begin
|
begin
|
||||||
writeln(' AAA TheFontStock.ReleaseFontsInfo Self=',HexStr(Cardinal(Self),8));
|
|
||||||
|
|
||||||
if Assigned(FpInfo) then
|
if Assigned(FpInfo) then
|
||||||
with GetFontsInfoManager do
|
with GetFontsInfoManager do
|
||||||
begin
|
begin
|
||||||
@ -853,14 +862,10 @@ begin
|
|||||||
SetBaseFont(ABaseFont);
|
SetBaseFont(ABaseFont);
|
||||||
FColor := clWindowText;
|
FColor := clWindowText;
|
||||||
FBkColor := clWindow;
|
FBkColor := clWindow;
|
||||||
|
|
||||||
writeln(' AAA TheTextDrawer.Create Self=',HexStr(Cardinal(Self),8));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TheTextDrawer.Destroy;
|
destructor TheTextDrawer.Destroy;
|
||||||
begin
|
begin
|
||||||
writeln(' AAA TheTextDrawer.Destroy Self=',HexStr(Cardinal(Self),8));
|
|
||||||
|
|
||||||
FFontStock.Free;
|
FFontStock.Free;
|
||||||
ReleaseETODist;
|
ReleaseETODist;
|
||||||
|
|
||||||
@ -1283,7 +1288,6 @@ end;
|
|||||||
{$ENDIF} // HE_LEADBYTES
|
{$ENDIF} // HE_LEADBYTES
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
SynTextDrawerFinalization:=false;
|
SynTextDrawerFinalization:=false;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -1293,11 +1297,15 @@ initialization
|
|||||||
|
|
||||||
finalization
|
finalization
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
// MG: We can't free the gFontsInfoManager here, because the synedit
|
||||||
|
// components need it and will be destroyed with the Application object in
|
||||||
|
// the lcl after this finalization section.
|
||||||
|
// So, the flag SynTextDrawerFinalization is set and the gFontsInfoManager
|
||||||
|
// will destroy itself, as soon, as it is not used anymore.
|
||||||
SynTextDrawerFinalization:=true;
|
SynTextDrawerFinalization:=true;
|
||||||
|
{$ELSE}
|
||||||
|
FreeAndNil(gFontsInfoManager);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
gFontsInfoManager.Free;
|
|
||||||
gFontsInfoManager:=nil;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user