IDEIntf: fixed crash on TIDEMenuSection.Clear, bug #30574

git-svn-id: branches/fixes_1_6@52936 -
This commit is contained in:
mattias 2016-09-08 11:02:41 +00:00
parent e8d8a7b44e
commit ae9d3b9797
3 changed files with 313 additions and 318 deletions

View File

@ -129,6 +129,7 @@ type
procedure SetChildrenAsSubMenu(const AValue: boolean); virtual;
procedure SetVisible(const AValue: Boolean); override;
procedure SetSubMenuImages(const AValue: TCustomImageList); virtual;
procedure SetMenuItem(const AValue: TMenuItem); override;
procedure ClearMenuItems; override;
procedure FreeTopSeparator;
procedure FreeBottomSeparator;
@ -972,6 +973,15 @@ begin
MenuItem.SubMenuImages:=SubMenuImages;
end;
procedure TIDEMenuSection.SetMenuItem(const AValue: TMenuItem);
begin
inherited SetMenuItem(AValue);
if (Section=nil) and (MenuItem<>nil) then begin
// root section -> create menu items
UpdateContainer;
end;
end;
procedure TIDEMenuSection.ClearMenuItems;
var
i: Integer;
@ -1062,6 +1072,7 @@ var
SubSection: TIDEMenuSection;
aVisible: Boolean;
begin
if imssClearing in aSection.FStates then exit;
aVisible:=aSection.RealVisible;
for i:=0 to aSection.Count-1 do begin
Item:=aSection[i];

View File

@ -2754,8 +2754,6 @@ var
VisibleCnt: Integer;
begin
MessagesMenuRoot.MenuItem:=MsgCtrlPopupMenu.Items;
MessagesMenuRoot.BeginUpdate;
try
HasText:=false;
HasFilename:=false;
MsgType:='';
@ -2891,9 +2889,6 @@ begin
UpdateFilterItems;
UpdateQuickFixes(Line);
finally
MessagesMenuRoot.EndUpdate;
end;
end;
procedure TMessagesFrame.OnSelectFilterClick(Sender: TObject);

View File

@ -6528,8 +6528,6 @@ var
begin
PopM:=TPopupMenu(Sender);
SourceTabMenuRoot.MenuItem:=PopM.Items;
SourceTabMenuRoot.BeginUpdate;
try
// Get the tab that was clicked
if PopM.PopupComponent is TPageControl then begin
PageCtrl:=TPageControl(PopM.PopupComponent);
@ -6629,9 +6627,6 @@ begin
end;
end;
finally
SourceTabMenuRoot.EndUpdate;
end;
end;
procedure TSourceNotebook.SrcPopUpMenuPopup(Sender: TObject);
@ -6666,8 +6661,6 @@ begin
IDECommandList.ExecuteUpdateEvents;
SourceEditorMenuRoot.MenuItem:=SrcPopupMenu.Items;
SourceEditorMenuRoot.BeginUpdate;
try
RemoveUserDefinedMenuItems;
RemoveContextMenuItems;
@ -6750,9 +6743,7 @@ begin
if Assigned(Manager.OnPopupMenu) then
Manager.OnPopupMenu(@AddContextPopupMenuItem);
SourceEditorMenuRoot.NotifySubSectionOnShow(Self);
finally
SourceEditorMenuRoot.EndUpdate;
end;
//SrcPopupMenu.Items.WriteDebugReport('TSourceNotebook.SrcPopUpMenuPopup() ');
end;
procedure TSourceNotebook.DbgPopUpMenuPopup(Sender: TObject);
@ -6809,8 +6800,6 @@ begin
Images := IDEImages.Images_16;
end;
// assign the root TMenuItem to the registered menu root.
// This will automatically create all registered items
{$IFDEF VerboseMenuIntf}
SrcPopupMenu.Items.WriteDebugReport('TSourceNotebook.BuildPopupMenu ');
SourceTabMenuRoot.ConsistencyCheck;