Make mruby raii cleanup, and fix cleanup bug.

- Functions were cleaned up after mruby, which was wrong.
- Becuase functions could have stored a reference to a Block which refers to mruby.
- And so it would crash on release builds at exit if custom functions were used.
This commit is contained in:
2026-09-08 23:12:52 +01:00
parent f5ec5516fa
commit 118934a393
4 changed files with 34 additions and 22 deletions
+1 -3
View File
@@ -14,6 +14,7 @@
namespace bed {
struct BEd {
internal::scripting::RubyState mrb;
internal::trie::Trie<internal::functions::Function> functions;
internal::functions::Function no_op;
internal::functions::Function eof_op;
@@ -24,9 +25,6 @@ struct BEd {
internal::vase::AppendStorage append{"/tmp"};
std::unordered_map<std::string, internal::buffer::Buffer *> buffers;
mrb_state *mrb = nullptr;
int arena;
bool help_mode = false;
bool prompt_mode = true;
std::function<std::string(BEd &)> prompt = nullptr;