desktop/source/lib/init.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
New commits: commit caa9192189f69b4f397724a8e79a425689f1d4fa Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Jun 2 12:16:29 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Jun 2 13:08:01 2022 +0200 fix handling of XTransferable2 if the type is only XTransferable Apparently some selections provide only XTransferable and not XTransferable2, making this entire call think that there's no selection at all. Handle that properly, and if XTransferable2 is not provided, then presumably it's not important to check for isComplex(). Change-Id: I3bbafe46a6b9ac8552c62e524137e1691b54895a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135299 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index cebbcdb573c2..db0fc5145fe9 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4682,14 +4682,15 @@ static int doc_getSelectionType(LibreOfficeKitDocument* pThis) return LOK_SELTYPE_NONE; } - css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(pDoc->getSelection(), css::uno::UNO_QUERY); + css::uno::Reference<css::datatransfer::XTransferable> xTransferable = pDoc->getSelection(); if (!xTransferable) { SetLastExceptionMsg("No selection available"); return LOK_SELTYPE_NONE; } - if (xTransferable->isComplex()) + css::uno::Reference<css::datatransfer::XTransferable2> xTransferable2(xTransferable, css::uno::UNO_QUERY); + if (xTransferable2.is() && xTransferable2->isComplex()) return LOK_SELTYPE_COMPLEX; OString aRet; @@ -4719,14 +4720,15 @@ static int doc_getSelectionTypeAndText(LibreOfficeKitDocument* pThis, const char return LOK_SELTYPE_NONE; } - css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(pDoc->getSelection(), css::uno::UNO_QUERY); + css::uno::Reference<css::datatransfer::XTransferable> xTransferable = pDoc->getSelection(); if (!xTransferable) { SetLastExceptionMsg("No selection available"); return LOK_SELTYPE_NONE; } - if (xTransferable->isComplex()) + css::uno::Reference<css::datatransfer::XTransferable2> xTransferable2(xTransferable, css::uno::UNO_QUERY); + if (xTransferable2.is() && xTransferable2->isComplex()) return LOK_SELTYPE_COMPLEX; const char *pType = pMimeType;