From 0109e0d7fe6dc8a85015ca4384dc88387b4ee425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 18 Jul 2018 19:53:55 +0200 Subject: [PATCH] Trade: convenience default constructor for AnimationTrackData. Otherwise one would need to use a NoInit Array constructor and that would cause dangling deleter function pointer call after the plugin gets unloaded. --- src/Magnum/Trade/AnimationData.h | 9 +++++++++ src/Magnum/Trade/Test/AnimationDataTest.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Magnum/Trade/AnimationData.h b/src/Magnum/Trade/AnimationData.h index 13113fbae..259b46a6e 100644 --- a/src/Magnum/Trade/AnimationData.h +++ b/src/Magnum/Trade/AnimationData.h @@ -163,6 +163,15 @@ API. */ class AnimationTrackData { public: + /** + * @brief Default constructor + * + * Leaves contents at unspecified values. Provided as a convenience for + * initialization of @ref AnimationData structure, expected to be + * replaced with concrete values later. + */ + /*implicit*/ AnimationTrackData() noexcept: _type{}, _resultType{}, _target{}, _targetId{}, _view{} {} + /** * @brief Constructor * @param type Value type diff --git a/src/Magnum/Trade/Test/AnimationDataTest.cpp b/src/Magnum/Trade/Test/AnimationDataTest.cpp index 62e95a636..5744d77fc 100644 --- a/src/Magnum/Trade/Test/AnimationDataTest.cpp +++ b/src/Magnum/Trade/Test/AnimationDataTest.cpp @@ -38,6 +38,8 @@ struct AnimationDataTest: TestSuite::Tester { void constructCopy(); void constructMove(); + void constructTrackDataDefault(); + void trackCustomResultType(); void trackWrongIndex(); @@ -53,6 +55,8 @@ AnimationDataTest::AnimationDataTest() { &AnimationDataTest::constructCopy, &AnimationDataTest::constructMove, + &AnimationDataTest::constructTrackDataDefault, + &AnimationDataTest::trackCustomResultType, &AnimationDataTest::trackWrongIndex, @@ -225,6 +229,11 @@ void AnimationDataTest::constructMove() { } } +void AnimationDataTest::constructTrackDataDefault() { + AnimationTrackData data; + CORRADE_VERIFY(true); /* no public accessors here, so nothing to check */ +} + void AnimationDataTest::trackCustomResultType() { using namespace Math::Literals;