Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorVsevolod Kukol <sevoku@xamarin.com>2016-04-15 12:42:18 +0300
committerVsevolod Kukol <sevoku@xamarin.com>2016-04-15 14:05:07 +0300
commit135233c3af0fa0516109a599b7b5346f57039715 (patch)
tree901974bff246f4064ace9940a9fe46cbdbf9051f /main
parent5fc652a9c26f3bf8057c8d505613d5b0e28b002c (diff)
[MacPlatform] Fix CommandArray menu item leak
When the items of an CommandArray menu entry are being updated, we first remove all previously inserted items. The cleanup routine expects them to be directly after the hidden target command item, but this was not the case because PopulateArrayItems inserts the items at the given index (which was the position of the target itself and not the position after/behind it), thus the old (hidden) items were not detected and removed correctly from the parent menu.
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs13
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs13
2 files changed, 22 insertions, 4 deletions
diff --git a/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs b/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
index 84585c1f40..caa93f33ee 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
@@ -109,6 +109,7 @@ namespace MonoDevelop.MacIntegration.MacMenu
}
}
+ index++;
PopulateArrayItems (info.ArrayInfo, parent, ref lastSeparator, ref index);
}
@@ -123,7 +124,10 @@ namespace MonoDevelop.MacIntegration.MacMenu
n.Hidden = true;
n.Target = this;
lastSeparator = n;
- parent.InsertItem (n, index++);
+ if (parent.Count > index)
+ parent.InsertItem (n, index);
+ else
+ parent.AddItem (n);
continue;
}
@@ -143,8 +147,13 @@ namespace MonoDevelop.MacIntegration.MacMenu
if (!item.Hidden)
MDMenu.ShowLastSeparator (ref lastSeparator);
- parent.InsertItem (item, index++);
+ if (parent.Count > index)
+ parent.InsertItem (item, index);
+ else
+ parent.AddItem (item);
+ index++;
}
+ index--;
}
class MDExpandedArrayItem : NSMenuItem
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs
index cc8a000bd8..bd15e84f84 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs
@@ -110,6 +110,7 @@ namespace MonoDevelop.Components.Mac
}
}
+ index++;
PopulateArrayItems (info.ArrayInfo, parent, ref lastSeparator, ref index);
}
@@ -124,7 +125,10 @@ namespace MonoDevelop.Components.Mac
n.Hidden = true;
n.Target = this;
lastSeparator = n;
- parent.InsertItem (n, index++);
+ if (parent.Count > index)
+ parent.InsertItem (n, index);
+ else
+ parent.AddItem (n);
continue;
}
@@ -144,8 +148,13 @@ namespace MonoDevelop.Components.Mac
if (!item.Hidden)
MDMenu.ShowLastSeparator (ref lastSeparator);
- parent.InsertItem (item, index++);
+ if (parent.Count > index)
+ parent.InsertItem (item, index);
+ else
+ parent.AddItem (item);
+ index++;
}
+ index--;
}
class MDExpandedArrayItem : NSMenuItem