mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 23:19:50 +02:00
IDE: fixed crash when freeing package after package editors
git-svn-id: trunk@34681 -
This commit is contained in:
parent
0bba1c10de
commit
ce9d9d44a2
@ -368,8 +368,10 @@ begin
|
|||||||
UncompressedMS.Position:=0;
|
UncompressedMS.Position:=0;
|
||||||
// reduce the risk of file corruption due to crashes while saving:
|
// reduce the risk of file corruption due to crashes while saving:
|
||||||
// save to a temporary file and then rename
|
// save to a temporary file and then rename
|
||||||
TempFilename:=FileProcs.GetTempFilename(Filename,'unitdictionary');
|
TempFilename:=FileProcs.GetTempFilename(Filename,'writing_tmp_');
|
||||||
UncompressedMS.SaveToFile(TempFilename);
|
UncompressedMS.SaveToFile(TempFilename);
|
||||||
|
if not DeleteFileUTF8(Filename) then
|
||||||
|
raise Exception.Create(Format(crsUnableToDelete, [Filename]));
|
||||||
if not RenameFileUTF8(TempFilename,Filename) then
|
if not RenameFileUTF8(TempFilename,Filename) then
|
||||||
raise Exception.Create(Format(crsUnableToRenameTo, [TempFilename,
|
raise Exception.Create(Format(crsUnableToRenameTo, [TempFilename,
|
||||||
Filename]));
|
Filename]));
|
||||||
|
@ -175,6 +175,7 @@ resourcestring
|
|||||||
crsAndMoreIdentifiers = '... and %s more identifiers';
|
crsAndMoreIdentifiers = '... and %s more identifiers';
|
||||||
crsCodyIdentifierDictionary = 'Identifier Dictionary';
|
crsCodyIdentifierDictionary = 'Identifier Dictionary';
|
||||||
crsUnableToRenameTo = 'unable to rename "%s" to "%s"';
|
crsUnableToRenameTo = 'unable to rename "%s" to "%s"';
|
||||||
|
crsUnableToDelete = 'Unable to delete "%s"';
|
||||||
crsPackagesUnitsIdentifiersFile = 'Packages: %s, Units: %s, Identifiers: %s%'
|
crsPackagesUnitsIdentifiersFile = 'Packages: %s, Units: %s, Identifiers: %s%'
|
||||||
+'sDatabase: %s';
|
+'sDatabase: %s';
|
||||||
crsNoneSelected = 'none selected';
|
crsNoneSelected = 'none selected';
|
||||||
|
@ -529,6 +529,10 @@ msgstr "Total"
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Typ"
|
msgstr "Typ"
|
||||||
|
|
||||||
|
#: codystrconsts.crsunabletodelete
|
||||||
|
msgid "Unable to delete \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: codystrconsts.crsunabletoreadfile
|
#: codystrconsts.crsunabletoreadfile
|
||||||
msgid "Unable to read file \"%s\"."
|
msgid "Unable to read file \"%s\"."
|
||||||
msgstr "Kann Datei \"%s\" nicht lesen."
|
msgstr "Kann Datei \"%s\" nicht lesen."
|
||||||
|
@ -534,6 +534,10 @@ msgstr "Totale"
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: codystrconsts.crsunabletodelete
|
||||||
|
msgid "Unable to delete \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: codystrconsts.crsunabletoreadfile
|
#: codystrconsts.crsunabletoreadfile
|
||||||
msgid "Unable to read file \"%s\"."
|
msgid "Unable to read file \"%s\"."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -521,6 +521,10 @@ msgstr ""
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: codystrconsts.crsunabletodelete
|
||||||
|
msgid "Unable to delete \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: codystrconsts.crsunabletoreadfile
|
#: codystrconsts.crsunabletoreadfile
|
||||||
msgid "Unable to read file \"%s\"."
|
msgid "Unable to read file \"%s\"."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -542,6 +542,10 @@ msgstr "Total"
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Tipo"
|
msgstr "Tipo"
|
||||||
|
|
||||||
|
#: codystrconsts.crsunabletodelete
|
||||||
|
msgid "Unable to delete \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: codystrconsts.crsunabletoreadfile
|
#: codystrconsts.crsunabletoreadfile
|
||||||
msgid "Unable to read file \"%s\"."
|
msgid "Unable to read file \"%s\"."
|
||||||
msgstr "Incapaz de ler o arquivo \"%s\"."
|
msgstr "Incapaz de ler o arquivo \"%s\"."
|
||||||
|
@ -543,6 +543,10 @@ msgstr "Всего"
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Тип"
|
msgstr "Тип"
|
||||||
|
|
||||||
|
#: codystrconsts.crsunabletodelete
|
||||||
|
msgid "Unable to delete \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: codystrconsts.crsunabletoreadfile
|
#: codystrconsts.crsunabletoreadfile
|
||||||
msgid "Unable to read file \"%s\"."
|
msgid "Unable to read file \"%s\"."
|
||||||
msgstr "Невозможно прочитать файл \"%s\"."
|
msgstr "Невозможно прочитать файл \"%s\"."
|
||||||
|
@ -547,6 +547,10 @@ msgstr "Загалом"
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Тип"
|
msgstr "Тип"
|
||||||
|
|
||||||
|
#: codystrconsts.crsunabletodelete
|
||||||
|
msgid "Unable to delete \"%s\""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: codystrconsts.crsunabletoreadfile
|
#: codystrconsts.crsunabletoreadfile
|
||||||
msgid "Unable to read file \"%s\"."
|
msgid "Unable to read file \"%s\"."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -294,7 +294,7 @@ type
|
|||||||
|
|
||||||
TPackageEditors = class
|
TPackageEditors = class
|
||||||
private
|
private
|
||||||
FItems: TList; // list of TPackageEditorForm
|
FItems: TFPList; // list of TPackageEditorForm
|
||||||
FOnAddToProject: TOnAddPkgToProject;
|
FOnAddToProject: TOnAddPkgToProject;
|
||||||
FOnAfterWritePackage: TIDEOptionsWriteEvent;
|
FOnAfterWritePackage: TIDEOptionsWriteEvent;
|
||||||
FOnBeforeReadPackage: TNotifyEvent;
|
FOnBeforeReadPackage: TNotifyEvent;
|
||||||
@ -2293,13 +2293,13 @@ end;
|
|||||||
|
|
||||||
constructor TPackageEditors.Create;
|
constructor TPackageEditors.Create;
|
||||||
begin
|
begin
|
||||||
FItems:=TList.Create;
|
FItems:=TFPList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TPackageEditors.Destroy;
|
destructor TPackageEditors.Destroy;
|
||||||
begin
|
begin
|
||||||
Clear;
|
Clear;
|
||||||
FItems.Free;
|
FreeAndNil(FItems);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2315,7 +2315,8 @@ end;
|
|||||||
|
|
||||||
procedure TPackageEditors.Remove(Editor: TPackageEditorForm);
|
procedure TPackageEditors.Remove(Editor: TPackageEditorForm);
|
||||||
begin
|
begin
|
||||||
FItems.Remove(Editor);
|
if FItems<>nil then
|
||||||
|
FItems.Remove(Editor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPackageEditors.IndexOfPackage(Pkg: TLazPackage): integer;
|
function TPackageEditors.IndexOfPackage(Pkg: TLazPackage): integer;
|
||||||
@ -2378,7 +2379,8 @@ end;
|
|||||||
|
|
||||||
procedure TPackageEditors.DoFreeEditor(Pkg: TLazPackage);
|
procedure TPackageEditors.DoFreeEditor(Pkg: TLazPackage);
|
||||||
begin
|
begin
|
||||||
FItems.Remove(Pkg.Editor);
|
if FItems<>nil then
|
||||||
|
FItems.Remove(Pkg.Editor);
|
||||||
if Assigned(OnFreeEditor) then OnFreeEditor(Pkg);
|
if Assigned(OnFreeEditor) then OnFreeEditor(Pkg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user