IDE: free msg file

git-svn-id: trunk@46928 -
This commit is contained in:
mattias 2014-11-21 08:19:32 +00:00
parent 21edb33745
commit 7ac6d9a919

View File

@ -423,8 +423,9 @@ type
fInheritedOptParseStamps: integer; fInheritedOptParseStamps: integer;
FParsedOpts: TParsedCompilerOptions; FParsedOpts: TParsedCompilerOptions;
FStorePathDelim: TPathDelimSwitch; FStorePathDelim: TPathDelimSwitch;
FFPCMsgFile: TFPCMsgFilePoolItem;
// Compilation // other tools
fExecuteBefore: TCompilationToolOptions; fExecuteBefore: TCompilationToolOptions;
fExecuteAfter: TCompilationToolOptions; fExecuteAfter: TCompilationToolOptions;
FCreateMakefileOnBuild: boolean; FCreateMakefileOnBuild: boolean;
@ -1105,6 +1106,8 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
destructor TBaseCompilerOptions.Destroy; destructor TBaseCompilerOptions.Destroy;
begin begin
if (FPCMsgFilePool<>nil) and (FFPCMsgFile<>nil) then
FPCMsgFilePool.UnloadFile(FFPCMsgFile);
FreeAndNil(fMessageFlags); FreeAndNil(fMessageFlags);
FreeAndNil(fBuildMacros); FreeAndNil(fBuildMacros);
FreeThenNil(fExecuteBefore); FreeThenNil(fExecuteBefore);
@ -2483,7 +2486,7 @@ var
DefaultTargetCPU: string; DefaultTargetCPU: string;
FPCompilerFilename: String; FPCompilerFilename: String;
s: string; s: string;
FPCMsgFile: TFPCMsgFilePoolItem; CurFPCMsgFile: TFPCMsgFilePoolItem;
procedure EnableDisableVerbosityFlag(Enable: boolean; c: char); procedure EnableDisableVerbosityFlag(Enable: boolean; c: char);
begin begin
@ -2990,13 +2993,19 @@ begin
// Passing a -vm ID, unknown by the current compiler will create an error // Passing a -vm ID, unknown by the current compiler will create an error
// => check the compiler message file // => check the compiler message file
if IDEMessageFlags.Count>0 then begin if IDEMessageFlags.Count>0 then begin
FPCMsgFile:=nil; if FPCMsgFilePool<>nil then begin
if FPCMsgFilePool<>nil then CurFPCMsgFile:=FPCMsgFilePool.LoadCurrentEnglishFile(true,nil);
FPCMsgFile:=FPCMsgFilePool.LoadCurrentEnglishFile(true,nil); if CurFPCMsgFile<>FFPCMsgFile then begin
t := IDEMessageFlags.GetMsgIdList(',',cfvHide,FPCMsgFile); if FFPCMsgFile<>nil then
FPCMsgFilePool.UnloadFile(FFPCMsgFile);
FFPCMsgFile:=CurFPCMsgFile;
end else
FPCMsgFilePool.UnloadFile(CurFPCMsgFile);
end;
t := IDEMessageFlags.GetMsgIdList(',',cfvHide,FFPCMsgFile);
if t <> '' then if t <> '' then
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t); switches := switches + ' ' + PrepareCmdLineOption('-vm'+t);
t := IDEMessageFlags.GetMsgIdList(',',cfvShow,FPCMsgFile); t := IDEMessageFlags.GetMsgIdList(',',cfvShow,FFPCMsgFile);
if t <> '' then if t <> '' then
switches := switches + ' ' + PrepareCmdLineOption('-vm-'+t); switches := switches + ' ' + PrepareCmdLineOption('-vm-'+t);
end; end;