Skip to content

Commit

Permalink
[audio] Move destructor out of luau GC
Browse files Browse the repository at this point in the history
  • Loading branch information
hgy29 committed May 9, 2023
1 parent 17fa9e9 commit 7800a89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion luabinding/audiobinder.cpp
Expand Up @@ -622,11 +622,19 @@ int AudioBinder::SoundChannel_destruct(void *p)
{
void *ptr = GIDEROS_DTOR_UDATA(p);
GGSoundChannel *soundChannel = static_cast<GGSoundChannel*>(ptr);
soundChannel->unref();
lua_postgc(soundChannel->L,SoundChannel_destruct_real,ptr);

return 0;
}

int AudioBinder::SoundChannel_destruct_real(lua_State *L, void *ptr)
{
G_UNUSED(L);
GGSoundChannel *soundChannel = static_cast<GGSoundChannel*>(ptr);
soundChannel->unref();

return 0;
}

int AudioBinder::SoundChannel_stop(lua_State *L)
{
Expand Down
1 change: 1 addition & 0 deletions luabinding/audiobinder.h
Expand Up @@ -18,6 +18,7 @@ class AudioBinder
static int Sound_hasEffect(lua_State *L);

static int SoundChannel_destruct(void *p);
static int SoundChannel_destruct_real(lua_State *L,void *p);
static int SoundChannel_stop(lua_State *L);
static int SoundChannel_setPosition(lua_State *L);
static int SoundChannel_getPosition(lua_State *L);
Expand Down

0 comments on commit 7800a89

Please sign in to comment.