summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-01-10 00:57:52 +0100
committerMichael Stahl <mstahl@redhat.com>2015-01-10 01:16:48 +0100
commit90d8f4fca566e46171b260ee3aadc655871c92ba (patch)
tree6f2001b36d1dfb2785b6e14f8bc515e15d827263
parentc6dc3b9f9adb292ae42ba246082bc9dcb1445c6c (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
-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 cdd36f1f9d2a..2d83cd945e6c 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
{