This commit is contained in:
ZakatTeamI2P 2026-04-23 20:03:53 +04:00
parent cf058bd113
commit 9c9af253dc
2 changed files with 10 additions and 7 deletions

View File

@ -594,3 +594,4 @@ static void mriBindingTerminate(){
static void mriBindingReset(){ static void mriBindingReset(){
rb_raise(getRbData()->exc[Reset], " "); rb_raise(getRbData()->exc[Reset], " ");
} }

View File

@ -30,10 +30,11 @@
#include <ruby.h> #include <ruby.h>
static void fileIntFreeInstance(void *inst){ static void fileIntFreeInstance(void *inst){
SDL_IOStream *ops = static_cast<SDL_IOStream*>(inst); SDL_IOStream *ops = static_cast<SDL_IOStream*>(inst);
SDL_CloseIO(ops); if (ops) {
SDL_CloseIO(ops);
}
} }
DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance); DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
static VALUE fileIntForPath(const char *path, bool rubyExc){ static VALUE fileIntForPath(const char *path, bool rubyExc){
@ -91,14 +92,15 @@ RB_METHOD(fileIntRead){
} }
RB_METHOD(fileIntClose){ RB_METHOD(fileIntClose){
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self); SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
if (!ops){ if (!ops){
printf("NULL guard! fileIntClose broken!"); printf("NULL guard! fileIntClose broken!");
return Qnil; return Qnil;
} }
SDL_CloseIO(ops); SDL_CloseIO(ops);
return Qnil; setPrivateData(self, nullptr);
return Qnil;
} }
RB_METHOD(fileIntGetByte){ RB_METHOD(fileIntGetByte){