Destroy CWinClipboard sufficiently early

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 28 September 2020 18:48 UTC

At least with a local --host=i686-pc-cygwin --enable-dbgutil Windows `make unitcheck slowcheck` build (i.e., similar to , which is often failing with aborted builds, presumably due to hung tests), I could once see a CppunitTest hang with just a main thread left at

> ntdll.dll!77acc62c() > [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] > KernelBase.dll!77492863() > rpcrt4.dll!773e55d9() > rpcrt4.dll!77466afb() > combase.dll!7576a02a() > combase.dll!7565072f() > combase.dll!7564b2dd() > combase.dll!7564b246() > combase.dll!756498a4() > combase.dll!757690ef() > vclplug_winlo.dll!sal::systools::COMReference::release() Line 166 > at C:\lo\core\include\systools\win32\comtools.hxx(166) > vclplug_winlo.dll!sal::systools::COMReference::~COMReference() Line 101 > at C:\lo\core\include\systools\win32\comtools.hxx(101) > vclplug_winlo.dll!CAPNDataObject::~CAPNDataObject() Line 97 > at C:\lo\core\vcl\win\dtrans\APNDataObject.cxx(97) > vclplug_winlo.dll!CAPNDataObject::`scalar deleting destructor'(unsigned int) > vclplug_winlo.dll!CAPNDataObject::Release() Line 137 > at C:\lo\core\vcl\win\dtrans\APNDataObject.cxx(137) > vclplug_winlo.dll!sal::systools::COMReference::release() Line 166 > at C:\lo\core\include\systools\win32\comtools.hxx(166) > vclplug_winlo.dll!sal::systools::COMReference::~COMReference() Line 101 > at C:\lo\core\include\systools\win32\comtools.hxx(101) > vclplug_winlo.dll!CDOTransferable::~CDOTransferable() > vclplug_winlo.dll!CDOTransferable::`scalar deleting destructor'(unsigned int) > cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 233 > at C:\lo\core\cppuhelper\source\weak.cxx(233) > vclplug_winlo.dll!cppu::WeakImplHelper::release() Line 115 > at C:\lo\core\include\cppuhelper\implbase.hxx(115) > vclplug_winlo.dll!com::sun::star::uno::Reference::~Reference() Line 110 > at C:\lo\core\include\com\sun\star\uno\Reference.hxx(110) > vclplug_winlo.dll!CWinClipboard::~CWinClipboard() Line 73 > at C:\lo\core\vcl\win\dtrans\WinClipboard.cxx(73) > vclplug_winlo.dll!CWinClipboard::`scalar deleting destructor'(unsigned int) > cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 233 > at C:\lo\core\cppuhelper\source\weak.cxx(233) > cppuhelper3MSC.dll!cppu::WeakComponentImplHelperBase::release() Line 86 > at C:\lo\core\cppuhelper\source\implbase.cxx(86) > vclplug_winlo.dll!cppu::PartialWeakComponentImplHelper::release() Line 86 > at C:\lo\core\include\cppuhelper\compbase.hxx(86) > vcllo.dll!com::sun::star::uno::Reference::~Reference() Line 110 > at C:\lo\core\include\com\sun\star\uno\Reference.hxx(110) > vcllo.dll!ImplSVData::~ImplSVData() Line 485 > at C:\lo\core\vcl\source\app\svdata.cxx(485) > vcllo.dll!`rtl::Static::get'::`2'::`dynamic atexit destructor for 'instance''() > ucrtbased.dll!72f16942() > ucrtbased.dll!72f16523() > ucrtbased.dll!72f010ac() > ntdll.dll!77ad9476() > ntdll.dll!77ad9476() > ntdll.dll!77ad93f0() > ntdll.dll!77afcbd8() > ntdll.dll!77aefdc8() > kernel32.dll!77736a14() > ntdll.dll!77aeab4f() > ntdll.dll!77aeab1a()

i.e., the ImplSVData::m_xSystemClipboard introduced by 974ea67a7c345a8be98c5aaa59baf9b07959b708 "tdf#129930: Dispose SystemClipboard service early enough" for some reason causing a COM issue when the static ImplSVData aImplSVData (vcl/source/app/svdata.cxx) gets destroyed during exit.

And with this change to vcl/source/app/svmain.cxx, I could still see CppunitTests hang with just a main thread left at

> [External Code] > vclplug_winlo.dll!sal::systools::COMReference::release() Line 166 > at C:\lo\core\include\systools\win32\comtools.hxx(166) > vclplug_winlo.dll!sal::systools::COMReference::~COMReference() Line 101 > at C:\lo\core\include\systools\win32\comtools.hxx(101) > vclplug_winlo.dll!CAPNDataObject::~CAPNDataObject() Line 97 > at C:\lo\core\vcl\win\dtrans\APNDataObject.cxx(97) > [External Code] > vclplug_winlo.dll!CAPNDataObject::Release() Line 137 > at C:\lo\core\vcl\win\dtrans\APNDataObject.cxx(137) > vclplug_winlo.dll!sal::systools::COMReference::release() Line 166 > at C:\lo\core\include\systools\win32\comtools.hxx(166) > vclplug_winlo.dll!sal::systools::COMReference::~COMReference() Line 101 > at C:\lo\core\include\systools\win32\comtools.hxx(101) > [External Code] > cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 233 > at C:\lo\core\cppuhelper\source\weak.cxx(233) > vclplug_winlo.dll!cppu::WeakImplHelper::release() Line 115 > at C:\lo\core\include\cppuhelper\implbase.hxx(115) > vclplug_winlo.dll!com::sun::star::uno::Reference::~Reference() Line 110 > at C:\lo\core\include\com\sun\star\uno\Reference.hxx(110) > vclplug_winlo.dll!CWinClipboard::~CWinClipboard() Line 73 > at C:\lo\core\vcl\win\dtrans\WinClipboard.cxx(73) > [External Code] > cppuhelper3MSC.dll!cppu::OWeakObject::release() Line 233 > at C:\lo\core\cppuhelper\source\weak.cxx(233) > cppuhelper3MSC.dll!cppu::WeakComponentImplHelperBase::release() Line 86 > at C:\lo\core\cppuhelper\source\implbase.cxx(86) > vclplug_winlo.dll!cppu::PartialWeakComponentImplHelper::release() Line 86 > at C:\lo\core\include\cppuhelper\compbase.hxx(86) > vclplug_winlo.dll!rtl::Reference::~Reference() Line 113 > at C:\lo\core\include\rtl\ref.hxx(113) > [External Code]

i.e., the static rtl::Reference g_Instance (vcl/win/dtrans/WinClipboard.cxx) introduced by b76e903ccc83d0ccf0c6548782622638dd8a0ee5 "dtrans/clipboard: create instances with uno constructors" still causing the same COM issue during exit.

Change-Id: Ib89d37a4fcb4b4a25e552a9dd14a96ade8e40309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103559

1dd01410e6c3 Destroy CWinClipboard sufficiently early
vcl/source/app/svmain.cxx | 1 +
vcl/vclplug_win.component | 3 +++
vcl/win/dtrans/WinClipboard.cxx | 32 +++++++++++++++++++++++++++++---
vcl/win/dtrans/WinClipboard.hxx | 2 ++
4 files changed, 35 insertions(+), 3 deletions(-)

Upstream: cgit.freedesktop.org


  • Share