summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui
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 /dbaccess/source/ui
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 'dbaccess/source/ui')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx4
-rw-r--r--dbaccess/source/ui/app/AppController.hxx2
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx8
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.hxx2
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx24
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx4
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx6
-rw-r--r--dbaccess/source/ui/control/toolboxcontroller.cxx12
-rw-r--r--dbaccess/source/ui/inc/callbacks.hxx3
-rw-r--r--dbaccess/source/ui/inc/dbtreelistbox.hxx2
-rw-r--r--dbaccess/source/ui/inc/toolboxcontroller.hxx3
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx9
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx6
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx16
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx4
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx28
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignControl.cxx12
18 files changed, 74 insertions, 75 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index c7850b23752c..b6d7c7541af2 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2331,9 +2331,9 @@ bool OApplicationController::interceptUserInput( const NotifyEvent& _rEvent )
return OGenericUnoController::interceptUserInput( _rEvent );
}
-PopupMenu* OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
+VclPtr<PopupMenu> OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
{
- return new PopupMenu( ModuleRes( RID_MENU_APP_EDIT ) );
+ return VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_EDIT ) );
}
IController& OApplicationController::getCommandController()
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index dec7e2fffd17..2fe7d7ed7b3a 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -532,7 +532,7 @@ namespace dbaui
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider
- virtual PopupMenu* getContextMenu( Control& _rControl ) const override;
+ virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index fb4564f203e6..e8c9f37e19ef 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -187,13 +187,11 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY))
,m_aPreview(VclPtr<OPreviewWindow>::Create(m_aBorder.get()))
,m_aDocumentInfo(VclPtr< ::svtools::ODocumentInfoPreview>::Create(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) )
+ ,m_aMenu( VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_PREVIEW ) ) )
,m_ePreviewMode(_ePreviewMode)
{
-
m_aBorder->SetBorderStyle(WindowBorderStyle::MONO);
- m_aMenu.reset(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
-
m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
@@ -242,7 +240,7 @@ void OAppDetailPageHelper::dispose()
rpBox.disposeAndClear();
}
}
- m_aMenu.reset();
+ m_aMenu.disposeAndClear();
m_pTablePreview.disposeAndClear();
m_aDocumentInfo.disposeAndClear();
m_aPreview.disposeAndClear();
@@ -1153,7 +1151,7 @@ IMPL_LINK_NOARG_TYPED(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
m_aTBPreview->Update();
// execute the menu
- std::unique_ptr<PopupMenu> aMenu(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
+ ScopedVclPtrInstance<PopupMenu> aMenu( ModuleRes( RID_MENU_APP_PREVIEW ) );
const sal_uInt16 pActions[] = { SID_DB_APP_DISABLE_PREVIEW
, SID_DB_APP_VIEW_DOC_PREVIEW
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 819a521d0c73..8f0d7996653d 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -86,7 +86,7 @@ namespace dbaui
VclPtr< ::svtools::ODocumentInfoPreview>
m_aDocumentInfo;
VclPtr<vcl::Window> m_pTablePreview;
- ::std::unique_ptr<PopupMenu> m_aMenu;
+ ScopedVclPtr<PopupMenu> m_aMenu;
PreviewMode m_ePreviewMode;
css::uno::Reference < css::frame::XFrame2 >
m_xFrame;
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 226eaaea6c2c..695a223b1fb2 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -650,7 +650,7 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM
bool bColAttrs = (nColId != (sal_uInt16)-1) && (nColId != 0);
if ( bColAttrs && !bDBIsReadOnly)
{
- PopupMenu aNewItems(ModuleRes(RID_SBA_GRID_COLCTXMENU));
+ ScopedVclPtrInstance<PopupMenu> aNewItems(ModuleRes(RID_SBA_GRID_COLCTXMENU));
sal_uInt16 nPos = 0;
sal_uInt16 nModelPos = static_cast<SbaGridControl*>(GetParent())->GetModelColumnPos(nColId);
Reference< XPropertySet > xField = static_cast<SbaGridControl*>(GetParent())->getField(nModelPos);
@@ -669,14 +669,14 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM
case DataType::REF:
break;
default:
- rMenu.InsertItem(ID_BROWSER_COLATTRSET, aNewItems.GetItemText(ID_BROWSER_COLATTRSET), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_COLATTRSET, aNewItems.GetHelpId(ID_BROWSER_COLATTRSET));
+ rMenu.InsertItem(ID_BROWSER_COLATTRSET, aNewItems->GetItemText(ID_BROWSER_COLATTRSET), MenuItemBits::NONE, OString(), nPos++);
+ rMenu.SetHelpId(ID_BROWSER_COLATTRSET, aNewItems->GetHelpId(ID_BROWSER_COLATTRSET));
rMenu.InsertSeparator(OString(), nPos++);
}
}
- rMenu.InsertItem(ID_BROWSER_COLWIDTH, aNewItems.GetItemText(ID_BROWSER_COLWIDTH), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_COLWIDTH, aNewItems.GetHelpId(ID_BROWSER_COLWIDTH));
+ rMenu.InsertItem(ID_BROWSER_COLWIDTH, aNewItems->GetItemText(ID_BROWSER_COLWIDTH), MenuItemBits::NONE, OString(), nPos++);
+ rMenu.SetHelpId(ID_BROWSER_COLWIDTH, aNewItems->GetHelpId(ID_BROWSER_COLWIDTH));
rMenu.InsertSeparator(OString(), nPos++);
}
}
@@ -751,23 +751,23 @@ void SbaGridControl::PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu)
{
FmGridControl::PreExecuteRowContextMenu(nRow, rMenu);
- PopupMenu aNewItems(ModuleRes(RID_SBA_GRID_ROWCTXMENU));
+ ScopedVclPtrInstance<PopupMenu> aNewItems(ModuleRes(RID_SBA_GRID_ROWCTXMENU));
sal_uInt16 nPos = 0;
if (!IsReadOnlyDB())
{
- rMenu.InsertItem(ID_BROWSER_TABLEATTR, aNewItems.GetItemText(ID_BROWSER_TABLEATTR), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_TABLEATTR, aNewItems.GetHelpId(ID_BROWSER_TABLEATTR));
+ rMenu.InsertItem(ID_BROWSER_TABLEATTR, aNewItems->GetItemText(ID_BROWSER_TABLEATTR), MenuItemBits::NONE, OString(), nPos++);
+ rMenu.SetHelpId(ID_BROWSER_TABLEATTR, aNewItems->GetHelpId(ID_BROWSER_TABLEATTR));
- rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems.GetItemText(ID_BROWSER_ROWHEIGHT), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, aNewItems.GetHelpId(ID_BROWSER_ROWHEIGHT));
+ rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems->GetItemText(ID_BROWSER_ROWHEIGHT), MenuItemBits::NONE, OString(), nPos++);
+ rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, aNewItems->GetHelpId(ID_BROWSER_ROWHEIGHT));
rMenu.InsertSeparator(OString(), nPos++);
}
if ( GetSelectRowCount() > 0 )
{
- rMenu.InsertItem(ID_BROWSER_COPY, aNewItems.GetItemText(SID_COPY), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_COPY, aNewItems.GetHelpId(SID_COPY));
+ rMenu.InsertItem(ID_BROWSER_COPY, aNewItems->GetItemText(SID_COPY), MenuItemBits::NONE, OString(), nPos++);
+ rMenu.SetHelpId(ID_BROWSER_COPY, aNewItems->GetHelpId(SID_COPY));
rMenu.InsertSeparator(OString(), nPos++);
}
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index f41c7e04de74..bae2bbfe1a23 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -3473,14 +3473,14 @@ bool SbaTableQueryBrowser::requestQuickHelp( const SvTreeListEntry* _pEntry, OUS
return false;
}
-PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
+VclPtr<PopupMenu> SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
{
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
"SbaTableQueryBrowser::getContextMenu: where does this come from?" );
if ( &m_pTreeView->getListBox() != &_rControl )
return nullptr;
- return new PopupMenu( ModuleRes( MENU_BROWSER_DEFAULTCONTEXT ) );
+ return VclPtr<PopupMenu>::Create( ModuleRes( MENU_BROWSER_DEFAULTCONTEXT ) );
}
IController& SbaTableQueryBrowser::getCommandController()
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 5fefdad6ac18..d212bd2ce689 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -551,9 +551,9 @@ namespace
}
}
-std::unique_ptr<PopupMenu> DBTreeListBox::CreateContextMenu()
+VclPtr<PopupMenu> DBTreeListBox::CreateContextMenu()
{
- ::std::unique_ptr< PopupMenu > pContextMenu;
+ VclPtr< PopupMenu > pContextMenu;
if ( !m_pContextMenuProvider )
return pContextMenu;
@@ -621,7 +621,7 @@ std::unique_ptr<PopupMenu> DBTreeListBox::CreateContextMenu()
if ( bModifiedMenu )
{
// the interceptor(s) modified the menu description => create a new PopupMenu
- PopupMenu* pModifiedMenu = new PopupMenu;
+ VclPtrInstance<PopupMenu> pModifiedMenu;
::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer(
pModifiedMenu, aEvent.ActionTriggerContainer );
aEvent.ActionTriggerContainer.clear();
diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx
index 2f8816e16aec..2208de1ae653 100644
--- a/dbaccess/source/ui/control/toolboxcontroller.cxx
+++ b/dbaccess/source/ui/control/toolboxcontroller.cxx
@@ -159,7 +159,7 @@ namespace dbaui
aFind->second = Event.IsEnabled;
if ( m_aCommandURL == aFind->first && !Event.IsEnabled )
{
- ::std::unique_ptr<PopupMenu> pMenu = getMenu();
+ ScopedVclPtr<PopupMenu> pMenu(getMenu());
sal_uInt16 nCount = pMenu->GetItemCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
@@ -177,12 +177,12 @@ namespace dbaui
}
}
}
- ::std::unique_ptr<PopupMenu> OToolboxController::getMenu()
+ VclPtr<PopupMenu> OToolboxController::getMenu()
{
- ::std::unique_ptr<PopupMenu> pMenu;
+ VclPtr<PopupMenu> pMenu;
if ( m_aStates.size() > 2 )
{
- pMenu.reset( new PopupMenu( ModuleRes( RID_MENU_APP_NEW ) ) );
+ pMenu = VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_NEW ) );
try
{
@@ -217,7 +217,7 @@ namespace dbaui
}
else
{
- pMenu.reset( new PopupMenu( ModuleRes( RID_MENU_REFRESH_DATA ) ) );
+ pMenu = VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_REFRESH_DATA ) );
}
return pMenu;
}
@@ -229,7 +229,7 @@ namespace dbaui
::osl::MutexGuard aGuard(m_aMutex);
VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get());
- ::std::unique_ptr<PopupMenu> pMenu = getMenu();
+ ScopedVclPtr<PopupMenu> pMenu(getMenu());
sal_uInt16 nSelected = pMenu->Execute(pToolBox, pToolBox->GetItemRect( m_nToolBoxId ),PopupMenuFlags::ExecuteDown);
// "cleanup" the toolbox state
diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx
index 9c2a579a7a51..c9e98ea41e9a 100644
--- a/dbaccess/source/ui/inc/callbacks.hxx
+++ b/dbaccess/source/ui/inc/callbacks.hxx
@@ -22,6 +22,7 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
+#include <vcl/vclptr.hxx>
#include <com/sun/star/container/XContainer.hpp>
class SvTreeListEntry;
@@ -74,7 +75,7 @@ namespace dbaui
The control itself will, using the controller provided by getCommandController,
disable menu entries as needed.
*/
- virtual PopupMenu* getContextMenu( Control& _rControl ) const = 0;
+ virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const = 0;
/** returns the controller which is responsible for providing states of certain features,
and executing them.
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index 21723a70ad7f..9a7413a6f0f0 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -111,7 +111,7 @@ namespace dbaui
virtual bool DoubleClickHdl() override;
- virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
+ virtual VclPtr<PopupMenu> CreateContextMenu() override;
virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) override;
void SetEnterKeyHdl(const Link<DBTreeListBox*,void>& rNewHdl) {m_aEnterKeyHdl = rNewHdl;}
diff --git a/dbaccess/source/ui/inc/toolboxcontroller.hxx b/dbaccess/source/ui/inc/toolboxcontroller.hxx
index 3e76fc23c8e9..05fba565f1d5 100644
--- a/dbaccess/source/ui/inc/toolboxcontroller.hxx
+++ b/dbaccess/source/ui/inc/toolboxcontroller.hxx
@@ -22,6 +22,7 @@
#include <svtools/toolboxcontroller.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <vcl/vclptr.hxx>
#include "apitools.hxx"
#include "moduledbu.hxx"
@@ -41,7 +42,7 @@ namespace dbaui
TCommandState m_aStates;
sal_uInt16 m_nToolBoxId;
- ::std::unique_ptr<PopupMenu> getMenu();
+ VclPtr<PopupMenu> getMenu();
public:
OToolboxController(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 02673fb6a1fb..68b7acc801af 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -230,12 +230,11 @@ namespace dbaui
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider
- virtual PopupMenu* getContextMenu( Control& _rControl ) const override;
- virtual IController& getCommandController() override;
+ virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
+ virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
- getContextMenuInterceptors() override;
- virtual css::uno::Any
- getCurrentSelection( Control& _rControl ) const override;
+ getContextMenuInterceptors() override;
+ virtual css::uno::Any getCurrentSelection( Control& _rControl ) const override;
virtual void impl_initialize() override;
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 4b85643bd96f..b2b839d7b62b 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -423,7 +423,7 @@ bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
if (pComEvt->IsMouseEvent())
ptWhere = pComEvt->GetMousePosPixel();
- PopupMenu aContextMenu(ModuleRes(RID_SBA_RTF_PKEYPOPUP));
+ ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_SBA_RTF_PKEYPOPUP));
// Should primary key checkbox be checked?
const sal_Int32 nCount = GetEntryCount();
bool bCheckOk = false;
@@ -443,9 +443,9 @@ bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
}
if (bCheckOk)
- aContextMenu.CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY );
+ aContextMenu->CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY );
- switch( aContextMenu.Execute( this, ptWhere ) )
+ switch( aContextMenu->Execute( this, ptWhere ) )
{
case SID_TABLEDESIGN_TABED_PRIMARYKEY:
{
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index d12eca785cad..1ea84c316836 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -1128,8 +1128,8 @@ bool OJoinTableView::IsAddAllowed()
void OJoinTableView::executePopup(const Point& _aPos, VclPtr<OTableConnection>& rSelConnection)
{
- PopupMenu aContextMenu( ModuleRes( RID_MENU_JOINVIEW_CONNECTION ) );
- switch (aContextMenu.Execute(this, _aPos))
+ ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_MENU_JOINVIEW_CONNECTION ) );
+ switch (aContextMenu->Execute(this, _aPos))
{
case SID_DELETE:
RemoveConnection(rSelConnection, true);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index cff9469c682b..e9d14ebfd121 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1951,8 +1951,8 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
{
- PopupMenu aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
- switch (aContextMenu.Execute(this, aMenuPos))
+ ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
+ switch (aContextMenu->Execute(this, aMenuPos))
{
case SID_DELETE:
RemoveField(nColId);
@@ -1968,13 +1968,13 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
{
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
{
- PopupMenu aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU));
- aContextMenu.CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]);
- aContextMenu.CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]);
- aContextMenu.CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
- aContextMenu.CheckItem( ID_QUERY_DISTINCT, static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
+ ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU));
+ aContextMenu->CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]);
+ aContextMenu->CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]);
+ aContextMenu->CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
+ aContextMenu->CheckItem( ID_QUERY_DISTINCT, static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
- switch (aContextMenu.Execute(this, aMenuPos))
+ switch (aContextMenu->Execute(this, aMenuPos))
{
case ID_QUERY_FUNCTION:
SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW));
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 10d3fd4e05bc..b699f0d6d20d 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -603,8 +603,8 @@ void OTableWindow::Command(const CommandEvent& rEvt)
ptWhere = m_xTitle->GetPosPixel();
}
- PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
- switch (aContextMenu.Execute(this, ptWhere))
+ ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
+ switch (aContextMenu->Execute(this, ptWhere))
{
case SID_DELETE:
Remove();
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 04da703df831..7a39f55d1392 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -1361,10 +1361,10 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
if ( !IsColumnSelected( nColId ) )
SelectColumnId( nColId );
- PopupMenu aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
- aContextMenu.EnableItem( SID_DELETE, false );
- aContextMenu.RemoveDisabledEntries(true, true);
- switch ( aContextMenu.Execute( this, aMenuPos ) )
+ ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
+ aContextMenu->EnableItem( SID_DELETE, false );
+ aContextMenu->RemoveDisabledEntries(true, true);
+ switch ( aContextMenu->Execute( this, aMenuPos ) )
{
case ID_BROWSER_COLWIDTH:
adjustBrowseBoxColumnWidth( this, nColId );
@@ -1375,18 +1375,18 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
}
else
{
- PopupMenu aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
+ ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
- aContextMenu.EnableItem( SID_CUT, IsCutAllowed(nRow) );
- aContextMenu.EnableItem( SID_COPY, IsCopyAllowed(nRow) );
- aContextMenu.EnableItem( SID_PASTE, IsPasteAllowed(nRow) );
- aContextMenu.EnableItem( SID_DELETE, IsDeleteAllowed(nRow) );
- aContextMenu.EnableItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsPrimaryKeyAllowed(nRow) );
- aContextMenu.EnableItem( SID_TABLEDESIGN_INSERTROWS, IsInsertNewAllowed(nRow) );
- aContextMenu.CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsRowSelected(GetCurRow()) && IsPrimaryKey() );
+ aContextMenu->EnableItem( SID_CUT, IsCutAllowed(nRow) );
+ aContextMenu->EnableItem( SID_COPY, IsCopyAllowed(nRow) );
+ aContextMenu->EnableItem( SID_PASTE, IsPasteAllowed(nRow) );
+ aContextMenu->EnableItem( SID_DELETE, IsDeleteAllowed(nRow) );
+ aContextMenu->EnableItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsPrimaryKeyAllowed(nRow) );
+ aContextMenu->EnableItem( SID_TABLEDESIGN_INSERTROWS, IsInsertNewAllowed(nRow) );
+ aContextMenu->CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsRowSelected(GetCurRow()) && IsPrimaryKey() );
// remove all the disable entries
- aContextMenu.RemoveDisabledEntries(true, true);
+ aContextMenu->RemoveDisabledEntries(true, true);
if( SetDataPtr(m_nDataPos) )
pDescrWin->SaveData( pActRow->GetActFieldDescr() );
@@ -1394,7 +1394,7 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
// All actions which change the number of rows must be run asynchronously
// otherwise there may be problems between the Context menu and the Browser
m_nDataPos = GetCurRow();
- switch (aContextMenu.Execute(this, aMenuPos))
+ switch (aContextMenu->Execute(this, aMenuPos))
{
case SID_CUT:
cut();
diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
index 77f0650e17da..668edcd69958 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
@@ -107,13 +107,13 @@ void OTableRowView::Command(const CommandEvent& rEvt)
if ( nColId == HANDLE_ID )
{
- PopupMenu aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
+ ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
long nSelectRowCount = GetSelectRowCount();
- aContextMenu.EnableItem( SID_CUT, nSelectRowCount != 0);
- aContextMenu.EnableItem( SID_COPY, nSelectRowCount != 0);
- aContextMenu.EnableItem( SID_PASTE, m_bClipboardFilled );
- aContextMenu.EnableItem( SID_DELETE, false );
- switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
+ aContextMenu->EnableItem( SID_CUT, nSelectRowCount != 0);
+ aContextMenu->EnableItem( SID_COPY, nSelectRowCount != 0);
+ aContextMenu->EnableItem( SID_PASTE, m_bClipboardFilled );
+ aContextMenu->EnableItem( SID_DELETE, false );
+ switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel()))
{
case SID_CUT:
cut();