summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-01-10 00:57:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-19 15:56:54 +0000
commitb84c8f64d0388369779c3977768c4f66071296fc (patch)
treea34eb8efe281a71ff6b81c5cc3e7e39a0c736151
parent678a7225249619a57dc3225feaf527ed45c70736 (diff)
fdo#87845: sw: fix crash in navigator dialog when view is closed
Since we have a SwContentTree::Notify() now, might as well clear our pointers to recently deceased SwWrtShells when the obituary arrives. (regression from b5c1f352522c34a744ad0226e73904ce5af81b11) Change-Id: I44282658468f1b758038fbf1c7fc13dfe1b4b8ed (cherry picked from commit 90d8f4fca566e46171b260ee3aadc655871c92ba) Reviewed-on: https://gerrit.libreoffice.org/13870 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit bfc20246a88b19461d4bc95df47095186200ca77) Reviewed-on: https://gerrit.libreoffice.org/14001 Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--sw/source/uibase/utlui/content.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index ef1fd2e90735..5a6c75ed307b 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -23,6 +23,7 @@
#include <tools/urlobj.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/dispatch.hxx>
+#include <sfx2/event.hxx>
#include <vcl/help.hxx>
#include <vcl/settings.hxx>
#include <sot/formats.hxx>
@@ -50,6 +51,7 @@
#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentOutlineNodes.hxx>
#include <unotools.hxx>
+#include <unotxvw.hxx>
#include <crsskip.hxx>
#include <cmdid.h>
#include <helpid.h>
@@ -2220,7 +2222,8 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
{
if(!lcl_FindShell(pActiveShell))
{
- EndListening(*pActiveShell->GetView().GetDocShell());
+ if (pActiveShell)
+ EndListening(*pActiveShell->GetView().GetDocShell());
pActiveShell = pSh;
bIsActive = true;
bIsConstant = false;
@@ -2231,7 +2234,8 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
// the screen filled new.
if(bIsActive && bClear)
{
- StartListening(*pActiveShell->GetView().GetDocShell());
+ if (pActiveShell)
+ StartListening(*pActiveShell->GetView().GetDocShell());
FindActiveTypeAndRemoveUserData();
for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
{
@@ -2267,6 +2271,17 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
if (pHint && SFX_HINT_DOCCHANGED == pHint->GetId())
{
m_bActiveDocModified = true;
+ return;
+ }
+
+ SfxViewEventHint const*const pVEHint(
+ dynamic_cast<SfxViewEventHint const*>(&rHint));
+ if (pActiveShell
+ && pVEHint && pVEHint->GetEventName() == "OnViewClosed"
+ && dynamic_cast<SwXTextView *>(pVEHint->GetController().get())
+ ->GetView() == &pActiveShell->GetView())
+ {
+ SetActiveShell(0); // our view is dying, clear our pointers to it
}
else
{