small fix for for #68, AV on runtime termination

This commit is contained in:
Basile Burg 2016-06-12 13:53:05 +02:00
parent 3dcb9cad50
commit 0f99653d2c
2 changed files with 19 additions and 16 deletions

View File

@ -881,8 +881,6 @@ begin
fProjectGroup := getProjectGroup;
//
getCMdParams;
if fNativeProject.isNil then
newNativeProj;
//
fInitialized := true;
end;
@ -1336,6 +1334,8 @@ begin
// see: http://forum.lazarus.freepascal.org/index.php/topic,30616.0.htm
if fAppliOpts.reloadLastDocuments then
LoadLastDocsAndProj;
if fProjectInterface = nil then
newNativeProj;
DockMaster.ResetSplitters;
@ -1398,8 +1398,11 @@ begin
(dlgFileChangeClose(fProjectInterface.filename) = mrCancel) then exit;
for i := fMultidoc.documentCount-1 downto 0 do
if not fMultidoc.closeDocument(i) then exit;
if fProjectGroup.groupModified then if
(dlgFileChangeClose(fProjectGroup.groupFilename) = mrCancel) then exit;
canClose := true;
closeProj;
fProjectGroup.closeGroup;
end;
procedure TCEMainForm.updateDocumentBasedAction(sender: TObject);
@ -2636,10 +2639,12 @@ begin
if fProjectInterface = nil then exit;
//
if not fProjectInterface.inGroup then
begin
fProjectInterface.getProject.Free;
fProjectInterface := nil;
fNativeProject := nil;
fDubProject := nil;
fProjectInterface := nil;
fNativeProject := nil;
fDubProject := nil;
end;
showProjTitle;
end;

View File

@ -85,8 +85,7 @@ type
procedure btnRemProjClick(Sender: TObject);
procedure lstProjDblClick(Sender: TObject);
private
fUngrouped: ICECommonProject;
fFromGroup: boolean;
fPrevProj: ICECommonProject;
fProjSubj: TCEProjectSubject;
//
procedure projNew(aProject: ICECommonProject);
@ -121,6 +120,7 @@ end;
destructor TProjectGroup.destroy;
begin
fItems.Clear;
fItems.Free;
inherited;
end;
@ -279,6 +279,7 @@ destructor TProjectGroupItem.destroy;
begin
if fProj <> nil then
fProj.getProject.free;
fProj := nil;
inherited;
end;
{$ENDREGION}
@ -297,8 +298,8 @@ end;
destructor TCEProjectGroupWidget.destroy;
begin
inherited;
fProjSubj.free;
inherited;
end;
procedure TCEProjectGroupWidget.DoShow;
@ -311,8 +312,7 @@ end;
{$REGION Widget ICEProjectObserver ---------------------------------------------}
procedure TCEProjectGroupWidget.projNew(aProject: ICECommonProject);
begin
if not fFromGroup then
fUngrouped := aProject;
fPrevProj := aProject;
end;
procedure TCEProjectGroupWidget.projChanged(aProject: ICECommonProject);
@ -322,14 +322,12 @@ end;
procedure TCEProjectGroupWidget.projClosing(aProject: ICECommonProject);
begin
if not fFromGroup then
fUngrouped := nil;
fPrevProj := nil;
end;
procedure TCEProjectGroupWidget.projFocused(aProject: ICECommonProject);
begin
if not fFromGroup then
fUngrouped := aProject;
fPrevProj := aProject;
end;
procedure TCEProjectGroupWidget.projCompiling(aProject: ICECommonProject);
@ -385,12 +383,12 @@ procedure TCEProjectGroupWidget.lstProjDblClick(Sender: TObject);
begin
if lstProj.ItemIndex = -1 then
exit;
fFromGroup := true;
TProjectGroupItem(lstProj.Selected.Data).lazyLoad;
if fPrevProj <> nil then
subjProjClosing(fProjSubj, fPrevProj);
subjProjFocused(fProjSubj, TProjectGroupItem(lstProj.Selected.Data).project);
if projectGroup.index <> lstProj.ItemIndex then
projectGroup.index := lstProj.ItemIndex;
fFromGroup := false;
end;
procedure TCEProjectGroupWidget.handleChanged(sender: TObject);