From 3430b5610b9740a592d9c2ca0634ddd04e1e3ca1 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 19 Apr 2017 01:19:59 +0100 Subject: vcl: protect Window from exceptions during construction. Probable fix for: http://crashreport.libreoffice.org/stats/crash_details/f69188bd-0fdd-4b74-9ec6-35b544cba0c9 Change-Id: I6442451785867f0fc2daf84776118b092d4d6a18 Reviewed-on: https://gerrit.libreoffice.org/36653 Tested-by: Jenkins Reviewed-by: Michael Meeks (cherry picked from commit 6827da5052bfe975a3b34af8dfa8af75d41e904c) Reviewed-on: https://gerrit.libreoffice.org/36675 Reviewed-by: Markus Mohrhard --- vcl/source/window/window.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 722486cc490f..2cd6307b2829 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -530,6 +530,7 @@ void Window::dispose() } delete mpWindowImpl->mpWinData; + mpWindowImpl->mpWinData = nullptr; // remove BorderWindow or Frame window data mpWindowImpl->mpBorderWindow.disposeAndClear(); @@ -556,11 +557,16 @@ void Window::dispose() SAL_WARN("vcl", "Window " << this << " marked as frame window, " "is missing from list of " << nWindows << " frames"); } - mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr ); - pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame ); + if (mpWindowImpl->mpFrame) // otherwise exception during init + { + mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr ); + pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame ); + } assert (mpWindowImpl->mpFrameData->mnFocusId == nullptr); assert (mpWindowImpl->mpFrameData->mnMouseMoveId == nullptr); + delete mpWindowImpl->mpFrameData; + mpWindowImpl->mpFrameData = nullptr; } // should be the last statements -- cgit v1.2.3