mirror of https://github.com/AxioDL/metaforce.git
CScriptMidi: Add destructor implementation
This ensures currently playing track is stopped, avoiding a UAF in Amuse.
This commit is contained in:
parent
7b6720628c
commit
937aeda51f
|
@ -16,6 +16,10 @@ CScriptMidi::CScriptMidi(TUniqueId id, const CEntityInfo& info, std::string_view
|
||||||
x34_song = g_SimplePool->GetObj(SObjectTag{FOURCC('CSNG'), csng});
|
x34_song = g_SimplePool->GetObj(SObjectTag{FOURCC('CSNG'), csng});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CScriptMidi::~CScriptMidi() {
|
||||||
|
StopInternal(0.f);
|
||||||
|
}
|
||||||
|
|
||||||
void CScriptMidi::StopInternal(float fadeTime) {
|
void CScriptMidi::StopInternal(float fadeTime) {
|
||||||
if (!x3c_handle) {
|
if (!x3c_handle) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
DEFINE_ENTITY
|
DEFINE_ENTITY
|
||||||
CScriptMidi(TUniqueId id, const CEntityInfo& info, std::string_view name, bool active, CAssetId csng, float, float,
|
CScriptMidi(TUniqueId id, const CEntityInfo& info, std::string_view name, bool active, CAssetId csng, float, float,
|
||||||
s32);
|
s32);
|
||||||
|
~CScriptMidi() override;
|
||||||
|
|
||||||
void Stop(CStateManager& mgr, float fadeTime);
|
void Stop(CStateManager& mgr, float fadeTime);
|
||||||
void Play(CStateManager& mgr, float fadeTime);
|
void Play(CStateManager& mgr, float fadeTime);
|
||||||
|
|
Loading…
Reference in New Issue