diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-11-05 08:26:19 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-11-05 13:47:39 +0100 |
commit | 9498a5dd652db72b15f97560ce1fd758748fb64c (patch) | |
tree | d865147f276eee0f50b0e94da99877ace6b950f0 /vcl/source/uitest | |
parent | 45a7fbfb4fbb85297cc2756bb9d4aa5b65932274 (diff) |
Make findChild more robust in the face of disposed windows
<https://ci.libreoffice.org/job/lo_ubsan/1815/> had once failed
UITest_sw_styleInspector with
> /vcl/source/window/window.cxx:3920:26: runtime error: member access within null pointer of type 'WindowImpl'
> #0 0x2b883bedef80 in vcl::Window::get_id() const /vcl/source/window/window.cxx:3920:26
> #1 0x2b883f186817 in (anonymous namespace)::findChild(vcl::Window*, rtl::OUString const&, bool) /vcl/source/uitest/uiobject.cxx:399:18
> #2 0x2b883f185f86 in WindowUIObject::get_child(rtl::OUString const&) /vcl/source/uitest/uiobject.cxx:451:28
> #3 0x2b883f20e117 in UIObjectUnoObj::getChild(rtl::OUString const&) /vcl/source/uitest/uno/uiobject_uno.cxx:41:45
> #4 0x2b883f20e4c4 in non-virtual thunk to UIObjectUnoObj::getChild(rtl::OUString const&) /vcl/source/uitest/uno/uiobject_uno.cxx
> #5 0x2b8879c1ceab in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) /bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77:5
> #6 0x2b8879c171c2 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233:13
> #7 0x2b8879c13d0d in unoInterfaceProxyDispatch /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
> #8 0x2b887efde9fa in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const /binaryurp/source/incomingrequest.cxx:235:13
> #9 0x2b887efd861a in binaryurp::IncomingRequest::execute() const /binaryurp/source/incomingrequest.cxx:78:26
> #10 0x2b887f0b5367 in request /binaryurp/source/reader.cxx:85:9
> #11 0x2b880b8b0144 in cppu_threadpool::JobQueue::enter(void const*, bool) /cppu/source/threadpool/jobqueue.cxx:100:17
> #12 0x2b880b8d3f6b in cppu_threadpool::ORequestThread::run() /cppu/source/threadpool/thread.cxx:165:31
> #13 0x2b880b8dfbcf in threadFunc /include/osl/thread.hxx:185:15
> #14 0x2b88025206e8 in osl_thread_start_Impl(void*) /sal/osl/unx/thread.cxx:264:9
> #15 0x2b880438be64 in start_thread (/lib64/libpthread.so.0+0x7e64)
> #16 0x2b8804cc188c in clone (/lib64/libc.so.6+0xfe88c)
apparently because pParent was non-null but already disposed (so mpWindowImpl
had already been cleared).
I don't know whether this situation can legitimately happen, or was fallout from
an actual error that happened earlier (and went unnoticed), but this is
apparently uitest-only code, so just make it more robust and be done with it.
Change-Id: I178fcf2fb70bf29bc6bbb246ebff5b1933579e5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105326
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source/uitest')
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 83c4727218d0..32d8d2417f0f 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -393,7 +393,7 @@ namespace { vcl::Window* findChild(vcl::Window* pParent, const OUString& rID, bool bRequireVisible = false) { - if (!pParent) + if (!pParent || pParent->IsDisposed()) return nullptr; if (pParent->get_id() == rID) |