Verify the animation impl type matches the animation ctrl type
This commit is contained in:
@@ -41,6 +41,8 @@ class WXDLLIMPEXP_CORE wxAnimationImpl : public wxObject, public wxRefCounter
|
||||
public:
|
||||
wxAnimationImpl() {}
|
||||
|
||||
virtual wxAnimationImplType GetImplType() = 0;
|
||||
|
||||
virtual bool IsOk() const = 0;
|
||||
|
||||
// can be -1
|
||||
|
@@ -24,6 +24,9 @@ class WXDLLIMPEXP_ADV wxAnimationGenericImpl : public wxAnimationImpl
|
||||
public:
|
||||
wxAnimationGenericImpl() {}
|
||||
|
||||
virtual wxAnimationImplType GetImplType() wxOVERRIDE
|
||||
{ return wxANIMATION_IMPL_TYPE_GENERIC; }
|
||||
|
||||
virtual bool IsOk() const wxOVERRIDE
|
||||
{ return m_refData != NULL; }
|
||||
|
||||
|
@@ -335,6 +335,9 @@ void wxGenericAnimationCtrl::SetAnimation(const wxAnimation& animation)
|
||||
if (IsPlaying())
|
||||
Stop();
|
||||
|
||||
wxCHECK_RET(animation.GetImpl()->GetImplType() == wxANIMATION_IMPL_TYPE_GENERIC,
|
||||
wxT("incorrect animation implementation type provided") );
|
||||
|
||||
// set new animation even if it's wxNullAnimation
|
||||
m_animation = animation;
|
||||
if (!m_animation.IsOk())
|
||||
|
Reference in New Issue
Block a user