Skip to content

Commit

Permalink
Fix embedded ruby initialization process
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonroelofs committed Jan 28, 2025
1 parent 3192234 commit ff0bc94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions test/embed_ruby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ void embed_ruby()

if (!initialized__)
{
int argc = 0;
char* argv = nullptr;
char** pArgv = &argv;

ruby_sysinit(&argc, &pArgv);
RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();
rb_gc_disable();

#if RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR >= 1
// Force the prelude / builtins
Expand Down
2 changes: 1 addition & 1 deletion test/test_Keep_Alive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TESTCASE(test_return)
Module m = define_module("TestingModule");

Object column = getColumn(m, 3);
//rb_gc_start();
rb_gc_start();
String name = column.call("name");
ASSERT_EQUAL("column_3", name.c_str());
}
4 changes: 2 additions & 2 deletions test/test_Tracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ TESTCASE(RubyObjectGced)
{
// Track the C++ object returned by keepPointer
Data_Object<MyClass> my_class1 = factory.call("keep_pointer");
//rb_gc_start();
rb_gc_start();
}

// Make my_class1 invalid
//rb_gc_start();
rb_gc_start();

// Get the object again - this should *not* return the previous value
Data_Object<MyClass> my_class2 = factory.call("keep_pointer");
Expand Down

0 comments on commit ff0bc94

Please sign in to comment.