Skip to content

Commit

Permalink
Don't update io which is subsequently stored. Retain the original. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix authored Nov 20, 2023
1 parent d9682cf commit 940a042
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/nio4r/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ static VALUE NIO_Monitor_initialize(VALUE self, VALUE io, VALUE interests, VALUE
rb_raise(rb_eArgError, "invalid event type %s (must be :r, :w, or :rw)", RSTRING_PTR(rb_funcall(interests, rb_intern("inspect"), 0)));
}

io = rb_convert_type(io, T_FILE, "IO", "to_io");
ev_io_init(&monitor->ev_io, NIO_Selector_monitor_callback, rb_io_descriptor(io), monitor->interests);
int descriptor = rb_io_descriptor(rb_convert_type(io, T_FILE, "IO", "to_io"));
ev_io_init(&monitor->ev_io, NIO_Selector_monitor_callback, descriptor, monitor->interests);

rb_ivar_set(self, rb_intern("io"), io);
rb_ivar_set(self, rb_intern("interests"), interests);
Expand Down

0 comments on commit 940a042

Please sign in to comment.