Skip to content

Commit

Permalink
fix double close
Browse files Browse the repository at this point in the history
  • Loading branch information
Speak2Erase committed Aug 15, 2024
1 parent 7d3394e commit 27d615b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion binding/filesystem-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@
#include <ruby/thread.h>
#endif

#include "debugwriter.h"

static void fileIntFreeInstance(void *inst) {
SDL_IOStream *ops = static_cast<SDL_IOStream *>(inst);

SDL_CloseIO(ops);
if (ops) // if we aren't closed already
SDL_CloseIO(ops);
}

#if RAPI_FULL > 187
Expand Down Expand Up @@ -130,6 +133,7 @@ RB_METHOD(fileIntClose) {

SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
SDL_CloseIO(ops);
setPrivateData(self, NULL); // mark as closed

return Qnil;
}
Expand Down

0 comments on commit 27d615b

Please sign in to comment.