Kaydet (Commit) 90d8f4fc authored tarafından Michael Stahl's avatar Michael Stahl

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 b5c1f352)

Change-Id: I44282658468f1b758038fbf1c7fc13dfe1b4b8ed
üst c6dc3b9f
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#include <sfx2/docfile.hxx> #include <sfx2/docfile.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/event.hxx>
#include <vcl/help.hxx> #include <vcl/help.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <sot/formats.hxx> #include <sot/formats.hxx>
...@@ -50,6 +51,7 @@ ...@@ -50,6 +51,7 @@
#include <IDocumentDrawModelAccess.hxx> #include <IDocumentDrawModelAccess.hxx>
#include <IDocumentOutlineNodes.hxx> #include <IDocumentOutlineNodes.hxx>
#include <unotools.hxx> #include <unotools.hxx>
#include <unotxvw.hxx>
#include <crsskip.hxx> #include <crsskip.hxx>
#include <cmdid.h> #include <cmdid.h>
#include <helpid.h> #include <helpid.h>
...@@ -2220,6 +2222,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh) ...@@ -2220,6 +2222,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
{ {
if(!lcl_FindShell(pActiveShell)) if(!lcl_FindShell(pActiveShell))
{ {
if (pActiveShell)
EndListening(*pActiveShell->GetView().GetDocShell()); EndListening(*pActiveShell->GetView().GetDocShell());
pActiveShell = pSh; pActiveShell = pSh;
bIsActive = true; bIsActive = true;
...@@ -2231,6 +2234,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh) ...@@ -2231,6 +2234,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
// the screen filled new. // the screen filled new.
if(bIsActive && bClear) if(bIsActive && bClear)
{ {
if (pActiveShell)
StartListening(*pActiveShell->GetView().GetDocShell()); StartListening(*pActiveShell->GetView().GetDocShell());
FindActiveTypeAndRemoveUserData(); FindActiveTypeAndRemoveUserData();
for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++) for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
...@@ -2267,6 +2271,17 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint) ...@@ -2267,6 +2271,17 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
if (pHint && SFX_HINT_DOCCHANGED == pHint->GetId()) if (pHint && SFX_HINT_DOCCHANGED == pHint->GetId())
{ {
m_bActiveDocModified = true; 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 else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment