summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/toolbox2.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index af7d38c54266..ba273c370734 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -2185,7 +2185,13 @@ void ToolBox::ImplExecuteCustomMenu()
// call button handler to allow for menu customization
mpData->maMenuButtonHdl.Call( this );
- // register handler
+ // We specifically only register this event listener when executing our
+ // overflow menu (and remove it directly afterwards), as the same menu
+ // is reused for both the overflow menu (as managed here in ToolBox),
+ // but also by ToolBarManager for its context menu. If we leave event
+ // listeners alive beyond when the menu is showing in the desired mode
+ // then duplicate events can happen as the context menu "duplicates"
+ // items from the overflow menu, which both listeners would then act on.
GetMenu()->AddEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
// make sure all disabled entries will be shown