From 9e7344ae5776117e94684713767fae1b0afbb6b9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 26 Jan 2018 10:29:43 +0200 Subject: tdf#115221 crash in printing and comment not wonderfully happy with this fix, because we're changing the delete ordering here, but the origin of this bug was commit a754294ac7a902fe96fbbd6b8b6824a360d6b248 use rtl::Reference in SwDocFac instead of manual acquire/releas and commit cc483d0470dbf0d01e4da818b148ff0b851c5187 (patch) tdf#112292 - fix memory leak and use more auto ref counting in sw so the delete ordering was obviously messed up in those already, and we have such a morass of callbacks here, I can't see where else to fix it. I tried to add a couple more "getDoc() != nullptr" checks, but we still ended up crashing with an SwViewShell that had a bad pLayoutAccess pointer. Change-Id: I4aa39d58ae25bed41e3fd2c32c6d53659012ec10 Reviewed-on: https://gerrit.libreoffice.org/48658 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit de9bcd167b059e00818304626c0cadaa330738a4) Reviewed-on: https://gerrit.libreoffice.org/48748 Reviewed-by: Miklos Vajna --- sw/source/core/view/vnew.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 2998ffb131f8..4c74acecdd09 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -324,9 +324,7 @@ SwViewShell::~SwViewShell() if ( mxDoc.get() ) { - auto x = mxDoc->getReferenceCount(); - mxDoc.clear(); - if( x > 1 ) + if( mxDoc->getReferenceCount() > 1 ) GetLayout()->ResetNewLayout(); } -- cgit v1.2.3