From a4acd375ef462a8e2c94a48251d1a73f3b643680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Aug 2025 15:44:28 +0200 Subject: [PATCH] HEIF: Implement CGDataProviderReleaseInfoCallback We don't do any releasing, but logging makes it clearer when CG is done with the data provider we give it. Change-Id: I520807d0097ff13202849b7ccbc553006436aa1a Reviewed-by: Volker Hilsheimer --- src/plugins/imageformats/shared/qiiofhelpers.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/imageformats/shared/qiiofhelpers.mm b/src/plugins/imageformats/shared/qiiofhelpers.mm index 6c0af962..1b7c52ea 100644 --- a/src/plugins/imageformats/shared/qiiofhelpers.mm +++ b/src/plugins/imageformats/shared/qiiofhelpers.mm @@ -71,6 +71,10 @@ static size_t cbPutBytes(void *info, const void *buffer, size_t count) return size_t(qMax(qint64(0), res)); } +static void cbRelease(void *info) +{ + qCDebug(lcImageIO) << "Releasing" << info; +} QImageIOPlugin::Capabilities QIIOFHelpers::systemCapabilities(const QString &uti) { @@ -109,8 +113,6 @@ QIIOFHelper::QIIOFHelper(QImageIOHandler *q) bool QIIOFHelper::initRead() { - static const CGDataProviderSequentialCallbacks cgCallbacks = { 0, &cbGetBytes, &cbSkipForward, &cbRewind, nullptr }; - if (cgImageSource) return true; if (!q_ptr || !q_ptr->device()) @@ -121,6 +123,10 @@ bool QIIOFHelper::initRead() const void *rawData = b->data().constData() + b->pos(); cgDataProvider = CGDataProviderCreateWithData(nullptr, rawData, size_t(b->data().size() - b->pos()), nullptr); } else { + static const CGDataProviderSequentialCallbacks cgCallbacks = { + 0, // Version, always 0 + &cbGetBytes, &cbSkipForward, &cbRewind, &cbRelease + }; cgDataProvider = CGDataProviderCreateSequential(q_ptr->device(), &cgCallbacks); }