sw/source/uibase/utlui/content.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
New commits: commit bfc20246a88b19461d4bc95df47095186200ca77 Author: Michael Stahl <mst...@redhat.com> Date: Sat Jan 10 00:57:52 2015 +0100 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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index ef1fd2e..5a6c75e 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 {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits