From 516f800f84b533db0082b1f39c19d1af40ab29c8 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 24 Nov 2023 20:25:47 +0100 Subject: tdf#158345: Opening Hyperlink dialog leads to crash terminate called after throwing an instance of 'com::sun::star::datatransfer::UnsupportedFlavorException' relevant part of bt from this exception: 0 0x00007f34fd6b0231 in __cxa_throw () at /lib/x86_64-linux-gnu/libstdc++.so.6 1 0x00007f34e9d8207d in x11::X11Transferable::getTransferData(com::sun::star::datatransfer::DataFlavor const&) (this=0x562594fc9af0, rFlavor=...) at /home/julien/lo/libreoffice/vcl/unx/generic/dtrans/X11_transferable.cxx:58 2 0x00007f34e9d825ec in non-virtual thunk to x11::X11Transferable::getTransferData(com::sun::star::datatransfer::DataFlavor const&) () at /home/julien/lo/libreoffice/instdir/program/libvclplug_genlo.so 3 0x00007f34e15589f2 in SvxHyperlinkTabPageBase::Reset(SfxItemSet const&) (this=0x5625958378f0, rItemSet=SfxItemSet of pool 0x562591482920 with parent 0x0 and Which ranges: [(10361, 10362)] = {...}) at /home/julien/lo/libreoffice/cui/source/dialogs/hltpbase.cxx:468 See full bt here: https://bugs.documentfoundation.org/attachment.cgi?id=191029 Regression from: 89d3735e05b98223a49a387421386fd736fc3de6^! tdf#146576 - Propose clipboard content when inserting a hyperlink Change-Id: Ic111b8348f2288c4e9e6760fe6f7f48faadec582 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159939 Tested-by: Julien Nabet Reviewed-by: Julien Nabet --- cui/source/dialogs/hltpbase.cxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index f2448460ee66..f0aa7c368c04 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -37,6 +37,7 @@ #include #include #include +#include using namespace ::ucbhelper; @@ -465,13 +466,21 @@ void SvxHyperlinkTabPageBase::Reset( const SfxItemSet& rItemSet) if (xTransferable->isDataFlavorSupported(aFlavor)) { OUString aClipBoardConentent; - if (xTransferable->getTransferData(aFlavor) >>= aClipBoardConentent) + try + { + if (xTransferable->getTransferData(aFlavor) >>= aClipBoardConentent) + { + INetURLObject aURL; + aURL.SetSmartURL(aClipBoardConentent); + if (!aURL.HasError()) + aStrURL + = aURL.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous); + } + } + // tdf#158345: Opening Hyperlink dialog leads to crash + // MimeType = "text/plain;charset=utf-16" + catch(const css::datatransfer::UnsupportedFlavorException&) { - INetURLObject aURL; - aURL.SetSmartURL(aClipBoardConentent); - if (!aURL.HasError()) - aStrURL - = aURL.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous); } } } -- cgit