diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2021-08-02 13:38:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2021-08-03 16:59:24 +0200 |
commit | ab281c561f7fa7a3512875a22423693dca84316a (patch) | |
tree | 953f50896b74cd143800dfbac9e309296c73a001 | |
parent | 5b98dd53c7dc101d3a5ff693d3f0520ec1abd3d1 (diff) |
vcl: avoid native widget pieces for disposed BorderWindow.
Fixes crash around help windows:
vcl::Window::IsCompoundControl() const
vcl/source/window/window2.cxx:1200
vcl::Window::Show(bool, ShowFlags)
vcl/source/window/window.cxx:2243 (discriminator 3)
vcl::Window::Show(bool, ShowFlags)
vcl/source/window/window.cxx:2298
HelpTextWindow::ImplShow()
vcl/source/app/help.cxx:371
Scheduler::ProcessTaskScheduling()
vcl/source/app/scheduler.cxx:495
Change-Id: Ia0205813f3e9d306314577d59d6cdd1bdfa0ee71
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119854
Tested-by: Jenkins
-rw-r--r-- | vcl/README.lifecycle | 12 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 5 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 2 |
3 files changed, 6 insertions, 13 deletions
diff --git a/vcl/README.lifecycle b/vcl/README.lifecycle index a309b65ef9ea..9933e40f0955 100644 --- a/vcl/README.lifecycle +++ b/vcl/README.lifecycle @@ -73,8 +73,8 @@ to lingering pointers to freed objects. VclPtr<PushButton> pButton; ... assert (pButton == nullptr || !pButton); // null - assert (pButton && !pButton->IsDisposed()); // alive - assert (pButton && pButton->IsDisposed()); // disposed + assert (pButton && !pButton->isDisposed()); // alive + assert (pButton && pButton->isDisposed()); // disposed ** ScopedVclPtr - making disposes easier @@ -189,8 +189,6 @@ ways and often both. ---------- What remains to be done ? ---------- - * Cleanup DogTags - * Expand the VclPtr pattern to many other less than safe VCL types. @@ -214,12 +212,6 @@ ways and often both. in 'get()' calls - to avoid needing explicit 'clear' code in destructors. - * VclBuilder 'makeFoo' methods - + these should return VclPtr<> types and have their - signatures adjusted en-masse. - + currently we use a VclPtr<> constructor with - SAL_NO_ACQUIRE inside the builder. - ---------- FAQ / debugging hints ---------- ** Compile with dbgutil diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c3897fddda76..9e082ca2ea34 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2266,7 +2266,8 @@ void Window::Show(bool bVisible, ShowFlags nFlags) // inherit native widget flag for form controls // required here, because frames never show up in the child hierarchy - which should be fixed... // eg, the drop down of a combobox which is a system floating window - if( mpWindowImpl->mbFrame && GetParent() && GetParent()->IsCompoundControl() && + if( mpWindowImpl->mbFrame && GetParent() && !GetParent()->isDisposed() && + GetParent()->IsCompoundControl() && GetParent()->IsNativeWidgetEnabled() != IsNativeWidgetEnabled() && !(GetStyle() & WB_TOOLTIPWIN) ) { @@ -3691,7 +3692,7 @@ void Window::EnableNativeWidget( bool bEnable ) bool Window::IsNativeWidgetEnabled() const { - return ImplGetWinData()->mbEnableNativeWidget; + return mpWindowImpl && ImplGetWinData()->mbEnableNativeWidget; } Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSpriteCanvas ) const diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 555bbef324e3..bd1b6a2f7102 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1191,7 +1191,7 @@ GetFocusFlags Window::GetGetFocusFlags() const bool Window::IsCompoundControl() const { - return mpWindowImpl->mbCompoundControl; + return mpWindowImpl && mpWindowImpl->mbCompoundControl; } bool Window::IsWait() const |