diff options
author | David Tardon <dtardon@redhat.com> | 2016-05-12 12:19:44 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-05-12 13:57:23 +0200 |
commit | 2f57b2280c453fd5e02b97fa63c67d3b796d492f (patch) | |
tree | fd87bba9ae394aaa08e515ade217b2c724baad57 /svtools | |
parent | 29093124c04e8a3745064c0ae7e43c2bb7e34113 (diff) |
do not try to use obj. that is already being disposed
Change-Id: Ibb25e5bfc3e161be9fdac124b5a107a6d180bf1e
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/toolbarmenu.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 67a0843f7235..07793e579300 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <memory> + #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <comphelper/processfactory.hxx> @@ -445,17 +447,17 @@ void ToolbarMenu::dispose() mpImpl->mxStatusListener.clear(); } + std::unique_ptr<ToolbarMenu_Impl> pImpl{mpImpl}; + mpImpl = nullptr; + // delete all menu entries - const int nEntryCount = mpImpl->maEntryVector.size(); + const int nEntryCount = pImpl->maEntryVector.size(); int nEntry; for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { - delete mpImpl->maEntryVector[nEntry]; + delete pImpl->maEntryVector[nEntry]; } - delete mpImpl; - mpImpl = nullptr; - DockingWindow::dispose(); } @@ -717,7 +719,7 @@ void ToolbarMenu::highlightFirstEntry() void ToolbarMenu::GetFocus() { - if( mpImpl->mnHighlightedEntry == -1 ) + if( mpImpl && mpImpl->mnHighlightedEntry == -1 ) implChangeHighlightEntry( 0 ); DockingWindow::GetFocus(); |