diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-02-09 10:55:16 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-04-30 11:04:33 +0200 |
commit | fedd7587477ae7c2b3f3cb350db3aeedbbb20f1c (patch) | |
tree | 2971f523d1abb408d52728cfbf4a4d7a5bca6d6d /vcl | |
parent | d45a0651990a58b8eb1306205cb2209d1012398f (diff) |
tdf#156562 qt: Don't cache supported mime types/data flavors
Drop the optimization to remember the supported
data flavors in `QtTransferable::m_aMimeTypeSeq`
and evaluate them each time instead.
This is in preparation of allowing to change
the mime data in an upcoming commit.
Another alternative would be to (re-)calculate
`QtTransferable::m_aMimeTypeSeq` only at the point
in time that the mime data are set. Keep that
in mind for further consideration in case this should
ever become relevant from a performance perspective.
Change-Id: Ic1792f6c2a19bf4c8f642a6288e9f3413fe7c893
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163303
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit ee03b3a7e85c7bb293e161cc6ea7fe7bb3bc9240)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166140
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/qt5/QtTransferable.hxx | 2 | ||||
-rw-r--r-- | vcl/qt5/QtTransferable.cxx | 13 |
2 files changed, 1 insertions, 14 deletions
diff --git a/vcl/inc/qt5/QtTransferable.hxx b/vcl/inc/qt5/QtTransferable.hxx index 5f1533dd5968..11d673b98a12 100644 --- a/vcl/inc/qt5/QtTransferable.hxx +++ b/vcl/inc/qt5/QtTransferable.hxx @@ -34,9 +34,7 @@ class QtTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransfera QtTransferable(const QtTransferable&) = delete; const QMimeData* m_pMimeData; - osl::Mutex m_aMutex; bool m_bProvideUTF16FromOtherEncoding; - css::uno::Sequence<css::datatransfer::DataFlavor> m_aMimeTypeSeq; public: QtTransferable(const QMimeData* pMimeData); diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index d9e0beaa71d3..675e5ef75cdc 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -50,16 +50,6 @@ QtTransferable::QtTransferable(const QMimeData* pMimeData) css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL QtTransferable::getTransferDataFlavors() { - // it's just filled once, ever, so just try to get it without locking first - if (m_aMimeTypeSeq.hasElements()) - return m_aMimeTypeSeq; - - // better safe then sorry; preventing broken usage - // DnD should not be shared and Clipboard access runs in the GUI thread - osl::MutexGuard aGuard(m_aMutex); - if (m_aMimeTypeSeq.hasElements()) - return m_aMimeTypeSeq; - QStringList aFormatList(m_pMimeData->formats()); // we might add the UTF-16 mime text variant later const int nMimeTypeSeqSize = aFormatList.size() + 1; @@ -113,8 +103,7 @@ css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL QtTransferable::getTr aMimeTypeSeq.realloc(nMimeTypeCount); - m_aMimeTypeSeq = aMimeTypeSeq; - return m_aMimeTypeSeq; + return aMimeTypeSeq; } sal_Bool SAL_CALL |