summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-01-06 10:49:31 +0300
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-02-20 22:42:14 +0100
commit1d51690ffd51cff963a3b083abb288f505f5cc64 (patch)
tree6031ca4629c5a1f39bd4b230ac8e65f93162de1b /include
parent48e58b3cedad3b5d6cb89df5d3d6576690690bf0 (diff)
tdf#130187: Don't crash on exiting print preview with Notebookbar
Crash caused by this sequence (tested in Writer): 1. Closing print preview, frame is attached to controller; 2. This calls SfxNotebookBar::StateMethod 3. There notebookbar's listener is added to list of the controller's context change event listeners 4. Then in SwPagePreview::~SwPagePreview, notebookbar's listener is added to that list again 5. ContextChangeEventMultiplexer::addContextChangeEventListener detects second addition, and throws an unhandled exception. I don't know why starting listening is needed in SwPagePreview dtor; unfortunately commit d05b7b32d9ecb6fcb4a268eb68cdcee09bafa6dd doesn't say much about context and reasons. ControlListener is renamed to ControlListenerForCurrentController to emphasize that it operates on the current controller of notebookbar's frame; and its bListen parameter meaning was reverted: previously its "true" value awkwardly meant "stop listening". All direct operations with listener of notebookbar are replaced with calls to notebookbar's methods. In ContextChangeEventMultiplexer::addContextChangeEventListener, uno::UNO_QUERY_THROW was replaced with uno::UNO_QUERY, because not only chart controller may appear here, and it's not an error: e.g. SfxBaseController doesn't implement lang::XServiceInfo. Regression after commit d05b7b32d9ecb6fcb4a268eb68cdcee09bafa6dd. Change-Id: Ief1aed188d8f02a6cfe3ea25f4d082dfdf449f32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86257 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87582 (cherry picked from commit fb2382ad4f33b885650ad5156ccaec4e90661806) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88229 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/notebookbar.hxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx
index af904ca2ae5f..457a64b9a206 100644
--- a/include/vcl/notebookbar.hxx
+++ b/include/vcl/notebookbar.hxx
@@ -14,6 +14,7 @@
#include <vcl/ctrl.hxx>
#include <vcl/NotebookBarAddonsMerger.hxx>
#include <vcl/settings.hxx>
+#include <set>
#include <vector>
namespace com { namespace sun { namespace star { namespace ui { class XContextChangeEventListener; } } } }
@@ -39,17 +40,17 @@ public:
void SetSystemWindow(SystemWindow* pSystemWindow);
- const css::uno::Reference<css::ui::XContextChangeEventListener>& getContextChangeEventListener() const { return m_pEventListener; }
-
void StateChanged(const StateChangedType nStateChange ) override;
void DataChanged(const DataChangedEvent& rDCEvt) override;
- void ControlListener(bool bListen);
+ void ControlListenerForCurrentController(bool bListen);
+ void StopListeningAllControllers();
private:
VclPtr<SystemWindow> m_pSystemWindow;
css::uno::Reference<css::ui::XContextChangeEventListener> m_pEventListener;
+ std::set<css::uno::Reference<css::frame::XController>> m_alisteningControllers;
std::vector<NotebookbarContextControl*> m_pContextContainers;
css::uno::Reference<css::frame::XFrame> mxFrame;