summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-20 15:56:35 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-23 06:28:00 +0000
commitaa0d0536a444fb26d9e570bd6bf6c1bdc3596cf3 (patch)
tree8b2a5207e77fa4054a37b33c25378c23a00af8ed /reportdesign
parentb722f3d6fc72877e8caaaae7291d5d736ddc494d (diff)
tdf#97527 - vcl: reference-count Menu
some places are marked with "dodgy"- need to check those to see what is going on, because they are leaving dangling pointers behind in the Menu class Change-Id: I41d5c7c0fec2f70ce9e3ffdc48cd03d26c0a869b Reviewed-on: https://gerrit.libreoffice.org/26516 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx6
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx18
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx6
3 files changed, 15 insertions, 15 deletions
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 83b28b2b8f9e..fdd00a77f12f 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -717,7 +717,7 @@ void OFieldExpressionControl::Command(const CommandEvent& rEvt)
if ( nColId == HANDLE_ID )
{
- PopupMenu aContextMenu(ModuleRes(RID_GROUPSROWPOPUPMENU));
+ ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_GROUPSROWPOPUPMENU));
bool bEnable = false;
long nIndex = FirstSelectedRow();
while( nIndex >= 0 && !bEnable )
@@ -726,8 +726,8 @@ void OFieldExpressionControl::Command(const CommandEvent& rEvt)
bEnable = true;
nIndex = NextSelectedRow();
}
- aContextMenu.EnableItem( SID_DELETE, IsDeleteAllowed() && bEnable );
- switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
+ aContextMenu->EnableItem( SID_DELETE, IsDeleteAllowed() && bEnable );
+ switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel()))
{
case SID_CUT:
cut();
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index 04138843284b..da0e0faa5ee9 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -306,27 +306,27 @@ void NavigatorTree::Command( const CommandEvent& rEvt )
uno::Reference< report::XGroup> xGroup(pData->getContent(),uno::UNO_QUERY);
bool bDeleteAllowed = m_rController.isEditable() && (xGroup.is() ||
uno::Reference< report::XFunction>(pData->getContent(),uno::UNO_QUERY).is());
- PopupMenu aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) );
+ ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) );
- sal_uInt16 nCount = aContextMenu.GetItemCount();
+ sal_uInt16 nCount = aContextMenu->GetItemCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
- if ( MenuItemType::SEPARATOR != aContextMenu.GetItemType(i))
+ if ( MenuItemType::SEPARATOR != aContextMenu->GetItemType(i))
{
- sal_uInt16 nId = aContextMenu.GetItemId(i);
+ sal_uInt16 nId = aContextMenu->GetItemId(i);
- aContextMenu.CheckItem(nId,m_rController.isCommandChecked(nId));
+ aContextMenu->CheckItem(nId,m_rController.isCommandChecked(nId));
bool bEnabled = m_rController.isCommandEnabled(nId);
if ( nId == SID_RPT_NEW_FUNCTION )
- aContextMenu.EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) );
+ aContextMenu->EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) );
// special condition, check for function and group
else if ( nId == SID_DELETE )
- aContextMenu.EnableItem(SID_DELETE,bDeleteAllowed);
+ aContextMenu->EnableItem(SID_DELETE,bDeleteAllowed);
else
- aContextMenu.EnableItem(nId,bEnabled);
+ aContextMenu->EnableItem(nId,bEnabled);
}
}
- sal_uInt16 nId = aContextMenu.Execute(this, aWhere);
+ sal_uInt16 nId = aContextMenu->Execute(this, aWhere);
if ( nId )
{
uno::Sequence< beans::PropertyValue> aArgs;
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 45665663c3d9..ce723b9a19fb 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -477,14 +477,14 @@ void OReportSection::Command( const CommandEvent& _rCEvt )
{
OReportController& rController = m_pParent->getViewsWindow()->getView()->getReportView()->getController();
uno::Reference<frame::XFrame> xFrame = rController.getFrame();
- PopupMenu aContextMenu( ModuleRes( RID_MENU_REPORT ) );
+ ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_MENU_REPORT ) );
uno::Reference< report::XReportDefinition> xReportDefinition = getSection()->getReportDefinition();
- lcl_insertMenuItemImages(aContextMenu,rController,xReportDefinition,xFrame);
+ lcl_insertMenuItemImages(*aContextMenu.get(),rController,xReportDefinition,xFrame);
Point aPos = _rCEvt.GetMousePosPixel();
m_pView->EndAction();
- const sal_uInt16 nId = aContextMenu.Execute(this, aPos);
+ const sal_uInt16 nId = aContextMenu->Execute(this, aPos);
if ( nId )
{
uno::Sequence< beans::PropertyValue> aArgs;