vcl/source/treelist/transfer.cxx | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 919f4a1430a6f1daba756b7f9f7615c3c9f603ae
Author: Michael Weghorn <[email protected]>
AuthorDate: Tue Jun 3 15:50:58 2025 +0200
Commit: Michael Weghorn <[email protected]>
CommitDate: Wed Jun 4 07:35:34 2025 +0200
tdf#166837 vcl: Unset terminate listener once it's been notified
When the TransferHelper's TerminateListener gets notified
that the desktop terminates, i.e. when
TransferableHelper::TerminateListener::notifyTermination
gets called, clear TransferableHelper::mxTerminateListener
once it has done its job (flushing content to the clipboard).
This prevents the TransferableHelper dtor from later trying
to create a Desktop instance using Desktop::create (to
remove the listener), which throws an exception because the
desktop has already been terminated, as seen with the qt6 vcl
plugin for the tdf#166837 scenario.
Backtrace of how TransferableHelper::TerminateListener::notifyTermination
was called:
1 TransferableHelper::TerminateListener::notifyTermination
transfer.cxx 287 0x7f566e7300a4
2 framework::Desktop::impl_sendTerminateToClipboard
desktop.cxx 1611 0x7f5674decc1e
3 framework::Desktop::terminate
desktop.cxx 281 0x7f5674debd0b
4 SfxApplication::MiscExec_Impl
appserv.cxx 437 0x7f5673a9071a
5 SfxStubSfxApplicationMiscExec_Impl
sfxslots.hxx 1300 0x7f5673a71f15
6 SfxDispatcher::Call_Impl
dispatch.cxx 256 0x7f5673bc9d9e
7 SfxDispatcher::PostMsgHandler
dispatch.cxx 997 0x7f5673bcf836
8 SfxHintPoster::DoEvent_Impl
hintpost.cxx 74 0x7f56740cd0ec
9 SfxHintPoster::LinkStubDoEvent_Impl
hintpost.cxx 54 0x7f56740cd02d
10 Link<void *, void>::Call
link.hxx 105 0x7f566e47dde1
11 ImplHandleUserEvent
winproc.cxx 2285 0x7f566e47a011
12 ImplWindowFrameProc
winproc.cxx 2849 0x7f566e476f3f
13 SalFrame::CallCallback
salframe.hxx 310 0x7f5665fd90ac
14 QtInstance::ProcessEvent
QtInstance.cxx 594 0x7f5665ffb25f
15 SalUserEventList::DispatchUserEvents(bool)::$_0::operator()() const
salusereventlist.cxx 119 0x7f566eb851bd
16 SalUserEventList::DispatchUserEvents
salusereventlist.cxx 120 0x7f566eb8508b
17 QtInstance::ImplYield
QtInstance.cxx 488 0x7f5665ff7a21
18 QtInstance::DoYield
QtInstance.cxx 510 0x7f5665ffadc1
19 ImplYield
svapp.cxx 385 0x7f566ec510d6
20 Application::Yield
svapp.cxx 488 0x7f566ec509ef
21 Application::Execute
svapp.cxx 360 0x7f566ec507d0
22 desktop::Desktop::Main
app.cxx 1680 0x7f5677b28e79
23 ImplSVMain
svmain.cxx 231 0x7f566ec7b066
24 SVMain
svmain.cxx 249 0x7f566ec7cb79
25 soffice_main
sofficemain.cxx 122 0x7f5677ba31da
26 sal_main
main.c 51 0x562d93f769fd
27 main
main.c 49 0x562d93f769d7
Backtrace of how the exception was triggered later:
1 __pthread_kill_implementation pthread_kill.c 44 0x7f567789e95c
2 __pthread_kill_internal pthread_kill.c 89 0x7f567789e9ff
3 __GI_raise raise.c 26 0x7f5677849cc2
4 __GI_abort abort.c 73 0x7f56778324ac
5 ?? 0x7f56774a1a3d
6 ?? 0x7f56774b344a
7 std::terminate() 0x7f56774a15e9
8 __clang_call_terminate 0x7f566e0b802e
9 TransferableHelper::~TransferableHelper transfer.cxx 307
0x7f566e7304fc
10 ScSelectionTransferObj::~ScSelectionTransferObj seltrans.cxx 163
0x7f563f2a5975
11 ScSelectionTransferObj::~ScSelectionTransferObj seltrans.cxx 151
0x7f563f2a59f9
12 cppu::OWeakObject::release weak.cxx 230 0x7f5675c30f65
13 cppu::WeakImplHelper<com::sun::star::datatransfer::XTransferable2,
com::sun::star::datatransfer::clipboard::XClipboardOwner,
com::sun::star::datatransfer::dnd::XDragSourceListener>::release implbase.hxx
115 0x7f563f227e65
14
com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable>::~Reference
Reference.hxx 114 0x7f5665f902ba
15 QtClipboard::~QtClipboard QtClipboard.hxx 30 0x7f5665f91590
16 QtClipboard::~QtClipboard QtClipboard.hxx 30 0x7f5665f915e9
17 cppu::OWeakObject::release weak.cxx 230 0x7f5675c30f65
18 cppu::WeakComponentImplHelperBase::release implbase.cxx 86
0x7f5675b3dad6
19
cppu::PartialWeakComponentImplHelper<com::sun::star::datatransfer::clipboard::XSystemClipboard,
com::sun::star::datatransfer::clipboard::XFlushableClipboard,
com::sun::star::lang::XServiceInfo>::release compbase.hxx 86 0x7f5665f91695
20
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>::~Reference
Reference.hxx 114 0x7f5665f90afa
21 std::pair<rtl::OUString const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>::~pair
stl_pair.h 284 0x7f56660048ad
22 std::destroy_at<std::pair<rtl::OUString const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>>
stl_construct.h 88 0x7f5666004885
23
std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString
const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>,
true>>>::destroy<std::pair<rtl::OUString const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>>
alloc_traits.h 599 0x7f56660047ab
24
std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString
const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>,
true>>>::_M_deallocate_node hashtable_policy.h 2046 0x7f56660047ab
25
std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString
const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>,
true>>>::_M_deallocate_nodes hashtable_policy.h 2068 0x7f5666004711
26 std::_Hashtable<rtl::OUString, std::pair<rtl::OUString const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>,
std::allocator<std::pair<rtl::OUString const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>>,
std::__detail::_Select1st, std::equal_to<rtl::OUString>,
std::hash<rtl::OUString>, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<true, false, true>>::clear hashtable.h 2588
0x7f566600463c
27 std::_Hashtable<rtl::OUString, std::pair<rtl::OUString const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>,
std::allocator<std::pair<rtl::OUString const,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>>,
std::__detail::_Select1st, std::equal_to<rtl::OUString>,
std::hash<rtl::OUString>, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<true, false, true>>::~_Hashtable hashtable.h
1671 0x7f56660045e9
28 std::__cxx1998::unordered_map<rtl::OUString,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>::~unordered_map
unordered_map.h 109 0x7f56660045a5
29 std::unordered_map<rtl::OUString,
com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard>>::~unordered_map
unordered_map 202 0x7f566600184d
30 QtInstance::~QtInstance QtInstance.cxx 326 0x7f5665ff9774
31 QtInstance::~QtInstance QtInstance.cxx 318 0x7f5665ff9809
32 DestroySalInstance salplug.cxx 361 0x7f566eb83d04
33 DeInitVCL svmain.cxx 599 0x7f566ec7ca95
34 ImplSVMain svmain.cxx 242 0x7f566ec7b0bf
35 SVMain svmain.cxx 249 0x7f566ec7cb79
36 soffice_main sofficemain.cxx 122 0x7f5677ba31da
37 sal_main main.c 51 0x562d93f769fd
38 main main.c 49 0x562d93f769d7
Change-Id: I92efa302395df884436201fb8262eeb0006c6db4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186149
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 3638c33007d3..6a0d1d79b6c3 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -285,6 +285,7 @@ void SAL_CALL
TransferableHelper::TerminateListener::queryTermination( const Eve
void SAL_CALL TransferableHelper::TerminateListener::notifyTermination( const
EventObject& )
{
mrParent.ImplFlush();
+ mrParent.mxTerminateListener.clear();
}
OUString SAL_CALL
TransferableHelper::TerminateListener::getImplementationName()