From 3ab77b91126f558b7e6d1c51628e82ac85cc90e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 20 Aug 2016 23:59:15 +0200 Subject: [PATCH] Stress how Array instances returned from plugins should look like. --- src/Magnum/Audio/AbstractImporter.h | 5 +++++ src/Magnum/Text/AbstractFontConverter.h | 5 +++++ src/Magnum/Trade/AbstractImageConverter.h | 5 +++++ src/Magnum/Trade/AbstractImporter.h | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/Magnum/Audio/AbstractImporter.h b/src/Magnum/Audio/AbstractImporter.h index 13daf32dd..1e069f2e5 100644 --- a/src/Magnum/Audio/AbstractImporter.h +++ b/src/Magnum/Audio/AbstractImporter.h @@ -61,6 +61,11 @@ checked by the implementation: there is any file opened. Plugin interface string is `"cz.mosra.magnum.Audio.AbstractImporter/0.1"`. + +@attention @ref Containers::Array instances returned from the plugin should + *not* use anything else than the default deleter, otherwise this can cause + dangling function pointer call on array destruction if the plugin gets + unloaded before the array is destroyed. */ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractManagingPlugin { CORRADE_PLUGIN_INTERFACE("cz.mosra.magnum.Audio.AbstractImporter/0.1") diff --git a/src/Magnum/Text/AbstractFontConverter.h b/src/Magnum/Text/AbstractFontConverter.h index 22c4c264c..04ceeef0e 100644 --- a/src/Magnum/Text/AbstractFontConverter.h +++ b/src/Magnum/Text/AbstractFontConverter.h @@ -69,6 +69,11 @@ checked by the implementation: array passed. Plugin interface string is `"cz.mosra.magnum.Text.AbstractFontConverter/0.1.2"`. + +@attention @ref Containers::Array instances returned from the plugin should + *not* use anything else than the default deleter, otherwise this can cause + dangling function pointer call on array destruction if the plugin gets + unloaded before the array is destroyed. */ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPlugin { CORRADE_PLUGIN_INTERFACE("cz.mosra.magnum.Text.AbstractFontConverter/0.1.2") diff --git a/src/Magnum/Trade/AbstractImageConverter.h b/src/Magnum/Trade/AbstractImageConverter.h index b5215f60d..9613d9932 100644 --- a/src/Magnum/Trade/AbstractImageConverter.h +++ b/src/Magnum/Trade/AbstractImageConverter.h @@ -63,6 +63,11 @@ checked by the implementation: if @ref Feature::ConvertCompressedData is supported. Plugin interface string is `"cz.mosra.magnum.Trade.AbstractImageConverter/0.2.1"`. + +@attention @ref Containers::Array instances returned from the plugin should + *not* use anything else than the default deleter, otherwise this can cause + dangling function pointer call on array destruction if the plugin gets + unloaded before the array is destroyed. */ class MAGNUM_EXPORT AbstractImageConverter: public PluginManager::AbstractManagingPlugin { CORRADE_PLUGIN_INTERFACE("cz.mosra.magnum.Trade.AbstractImageConverter/0.2.1") diff --git a/src/Magnum/Trade/AbstractImporter.h b/src/Magnum/Trade/AbstractImporter.h index f0bf089e3..2c4ef1d9e 100644 --- a/src/Magnum/Trade/AbstractImporter.h +++ b/src/Magnum/Trade/AbstractImporter.h @@ -74,6 +74,11 @@ checked by the implementation: Plugin interface string is `"cz.mosra.magnum.Trade.AbstractImporter/0.3"`. +@attention @ref Containers::Array instances returned from the plugin should + *not* use anything else than the default deleter, otherwise this can cause + dangling function pointer call on array destruction if the plugin gets + unloaded before the array is destroyed. + @todo How to handle casting from std::unique_ptr<> in more convenient way? */ class MAGNUM_EXPORT AbstractImporter: public PluginManager::AbstractManagingPlugin {