mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 13:26:38 +02:00
Fix bug with callbacks when loading a script already loaded
This commit is contained in:
@@ -65,6 +65,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
|
||||
(void) class;
|
||||
|
||||
ruby_current_script = NULL;
|
||||
ruby_registered_script = NULL;
|
||||
|
||||
c_name = NULL;
|
||||
c_author = NULL;
|
||||
@@ -120,6 +121,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
|
||||
|
||||
if (ruby_current_script)
|
||||
{
|
||||
ruby_registered_script = ruby_current_script;
|
||||
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
|
||||
@@ -64,6 +64,7 @@ int ruby_quiet = 0;
|
||||
struct t_plugin_script *ruby_scripts = NULL;
|
||||
struct t_plugin_script *last_ruby_script = NULL;
|
||||
struct t_plugin_script *ruby_current_script = NULL;
|
||||
struct t_plugin_script *ruby_registered_script = NULL;
|
||||
const char *ruby_current_script_filename = NULL;
|
||||
|
||||
/*
|
||||
@@ -476,6 +477,7 @@ weechat_ruby_load (const char *filename)
|
||||
}
|
||||
|
||||
ruby_current_script = NULL;
|
||||
ruby_registered_script = NULL;
|
||||
|
||||
snprintf (modname, sizeof(modname), "%s%d", MOD_NAME_PREFIX, ruby_num);
|
||||
ruby_num++;
|
||||
@@ -553,7 +555,7 @@ weechat_ruby_load (const char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ruby_current_script == NULL)
|
||||
if (!ruby_registered_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: function \"register\" not "
|
||||
@@ -561,6 +563,7 @@ weechat_ruby_load (const char *filename)
|
||||
weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename);
|
||||
return 0;
|
||||
}
|
||||
ruby_current_script = ruby_registered_script;
|
||||
|
||||
ruby_current_script->interpreter = (VALUE *) curModule;
|
||||
rb_gc_register_address (ruby_current_script->interpreter);
|
||||
|
||||
@@ -31,6 +31,7 @@ extern int ruby_quiet;
|
||||
extern struct t_plugin_script *ruby_scripts;
|
||||
extern struct t_plugin_script *last_ruby_script;
|
||||
extern struct t_plugin_script *ruby_current_script;
|
||||
extern struct t_plugin_script *ruby_registered_script;
|
||||
extern const char *ruby_current_script_filename;
|
||||
|
||||
extern void *weechat_ruby_exec (struct t_plugin_script *script,
|
||||
|
||||
Reference in New Issue
Block a user