mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Fix bug with callbacks when loading a script already loaded
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
WeeChat ChangeLog
|
||||
=================
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
v0.3.2-dev, 2010-03-21
|
||||
v0.3.2-dev, 2010-03-24
|
||||
|
||||
|
||||
Version 0.3.2 (under dev!)
|
||||
@@ -43,6 +43,7 @@ Version 0.3.2 (under dev!)
|
||||
* api: return absolute path for info_get of "weechat_dir" (bug #27936)
|
||||
* alias: add custom completion for aliases (task #9479)
|
||||
* scripts: allow script commands to reload only one script
|
||||
* scripts: fix bug with callbacks when loading a script already loaded
|
||||
* perl: fix crash when callbacks are called during script initialization
|
||||
(bug #29018)
|
||||
* irc: add SASL authentication, with PLAIN and DH-BLOWFISH mechanisms
|
||||
|
||||
@@ -70,6 +70,7 @@ weechat_lua_api_register (lua_State *L)
|
||||
(void) L;
|
||||
|
||||
lua_current_script = NULL;
|
||||
lua_registered_script = NULL;
|
||||
|
||||
name = NULL;
|
||||
author = NULL;
|
||||
@@ -119,6 +120,7 @@ weechat_lua_api_register (lua_State *L)
|
||||
charset);
|
||||
if (lua_current_script)
|
||||
{
|
||||
lua_registered_script = lua_current_script;
|
||||
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
|
||||
@@ -45,6 +45,7 @@ int lua_quiet = 0;
|
||||
struct t_plugin_script *lua_scripts = NULL;
|
||||
struct t_plugin_script *last_lua_script = NULL;
|
||||
struct t_plugin_script *lua_current_script = NULL;
|
||||
struct t_plugin_script *lua_registered_script = NULL;
|
||||
const char *lua_current_script_filename = NULL;
|
||||
lua_State *lua_current_interpreter = NULL;
|
||||
|
||||
@@ -192,6 +193,7 @@ weechat_lua_load (const char *filename)
|
||||
}
|
||||
|
||||
lua_current_script = NULL;
|
||||
lua_registered_script = NULL;
|
||||
|
||||
lua_current_interpreter = lua_open ();
|
||||
|
||||
@@ -266,7 +268,7 @@ weechat_lua_load (const char *filename)
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
if (lua_current_script == NULL)
|
||||
if (!lua_registered_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: function \"register\" not "
|
||||
@@ -275,6 +277,7 @@ weechat_lua_load (const char *filename)
|
||||
lua_close (lua_current_interpreter);
|
||||
return 0;
|
||||
}
|
||||
lua_current_script = lua_registered_script;
|
||||
|
||||
lua_current_script->interpreter = (lua_State *) lua_current_interpreter;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ extern int lua_quiet;
|
||||
extern struct t_plugin_script *lua_scripts;
|
||||
extern struct t_plugin_script *last_lua_script;
|
||||
extern struct t_plugin_script *lua_current_script;
|
||||
extern struct t_plugin_script *lua_registered_script;
|
||||
extern const char *lua_current_script_filename;
|
||||
extern lua_State *lua_current_interpreter;
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ XS (XS_weechat_api_register)
|
||||
(void) cv;
|
||||
|
||||
perl_current_script = NULL;
|
||||
perl_registered_script = NULL;
|
||||
|
||||
if (items < 7)
|
||||
{
|
||||
@@ -111,6 +112,7 @@ XS (XS_weechat_api_register)
|
||||
description, shutdown_func, charset);
|
||||
if (perl_current_script)
|
||||
{
|
||||
perl_registered_script = perl_current_script;
|
||||
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
|
||||
@@ -43,6 +43,7 @@ int perl_quiet = 0;
|
||||
struct t_plugin_script *perl_scripts = NULL;
|
||||
struct t_plugin_script *last_perl_script = NULL;
|
||||
struct t_plugin_script *perl_current_script = NULL;
|
||||
struct t_plugin_script *perl_registered_script = NULL;
|
||||
const char *perl_current_script_filename = NULL;
|
||||
int perl_quit_or_upgrade = 0;
|
||||
|
||||
@@ -221,8 +222,7 @@ weechat_perl_exec (struct t_plugin_script *script,
|
||||
FREETMPS;
|
||||
LEAVE;
|
||||
|
||||
if (old_perl_current_script)
|
||||
perl_current_script = old_perl_current_script;
|
||||
perl_current_script = old_perl_current_script;
|
||||
#ifdef MULTIPLICITY
|
||||
PERL_SET_CONTEXT (old_context);
|
||||
#else
|
||||
@@ -286,6 +286,7 @@ weechat_perl_load (const char *filename)
|
||||
}
|
||||
|
||||
perl_current_script = NULL;
|
||||
perl_registered_script = NULL;
|
||||
|
||||
#ifdef MULTIPLICITY
|
||||
perl_current_interpreter = perl_alloc();
|
||||
@@ -386,8 +387,8 @@ weechat_perl_load (const char *filename)
|
||||
}
|
||||
|
||||
free (eval);
|
||||
|
||||
if (!perl_current_script)
|
||||
|
||||
if (!perl_registered_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: function \"register\" not "
|
||||
@@ -399,7 +400,8 @@ weechat_perl_load (const char *filename)
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
perl_current_script = perl_registered_script;
|
||||
|
||||
#ifdef MULTIPLICITY
|
||||
perl_current_script->interpreter = (PerlInterpreter *)perl_current_interpreter;
|
||||
#else
|
||||
|
||||
@@ -31,6 +31,7 @@ extern int perl_quiet;
|
||||
extern struct t_plugin_script *perl_scripts;
|
||||
extern struct t_plugin_script *last_perl_script;
|
||||
extern struct t_plugin_script *perl_current_script;
|
||||
extern struct t_plugin_script *perl_registered_script;
|
||||
extern const char *perl_current_script_filename;
|
||||
|
||||
extern void *weechat_perl_exec (struct t_plugin_script *script,
|
||||
|
||||
@@ -66,6 +66,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
|
||||
(void) self;
|
||||
|
||||
python_current_script = NULL;
|
||||
python_registered_script = NULL;
|
||||
|
||||
name = NULL;
|
||||
author = NULL;
|
||||
@@ -102,6 +103,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
|
||||
description, shutdown_func, charset);
|
||||
if (python_current_script)
|
||||
{
|
||||
python_registered_script = python_current_script;
|
||||
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
|
||||
@@ -41,6 +41,7 @@ int python_quiet;
|
||||
struct t_plugin_script *python_scripts = NULL;
|
||||
struct t_plugin_script *last_python_script = NULL;
|
||||
struct t_plugin_script *python_current_script = NULL;
|
||||
struct t_plugin_script *python_registered_script = NULL;
|
||||
const char *python_current_script_filename = NULL;
|
||||
PyThreadState *python_mainThreadState = NULL;
|
||||
|
||||
@@ -228,8 +229,7 @@ weechat_python_exec (struct t_plugin_script *script,
|
||||
|
||||
/* PyEval_ReleaseThread (python_current_script->interpreter); */
|
||||
|
||||
if (old_python_current_script)
|
||||
python_current_script = old_python_current_script;
|
||||
python_current_script = old_python_current_script;
|
||||
|
||||
if (old_interpreter)
|
||||
PyThreadState_Swap (old_interpreter);
|
||||
@@ -335,6 +335,7 @@ weechat_python_load (const char *filename)
|
||||
}
|
||||
|
||||
python_current_script = NULL;
|
||||
python_registered_script = NULL;
|
||||
|
||||
/* PyEval_AcquireLock (); */
|
||||
python_current_interpreter = Py_NewInterpreter ();
|
||||
@@ -492,7 +493,7 @@ weechat_python_load (const char *filename)
|
||||
|
||||
fclose (fp);
|
||||
|
||||
if (python_current_script == NULL)
|
||||
if (!python_registered_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: function \"register\" not "
|
||||
@@ -506,6 +507,7 @@ weechat_python_load (const char *filename)
|
||||
|
||||
return 0;
|
||||
}
|
||||
python_current_script = python_registered_script;
|
||||
|
||||
python_current_script->interpreter = (PyThreadState *) python_current_interpreter;
|
||||
/* PyEval_ReleaseThread (python_current_script->interpreter); */
|
||||
|
||||
@@ -31,6 +31,7 @@ extern int python_quiet;
|
||||
extern struct t_plugin_script *python_scripts;
|
||||
extern struct t_plugin_script *last_python_script;
|
||||
extern struct t_plugin_script *python_current_script;
|
||||
extern struct t_plugin_script *python_registered_script;
|
||||
extern const char *python_current_script_filename;
|
||||
|
||||
extern void *weechat_python_exec (struct t_plugin_script *script,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -170,6 +170,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
|
||||
(void) clientData;
|
||||
|
||||
tcl_current_script = NULL;
|
||||
tcl_registered_script = NULL;
|
||||
|
||||
if (objc < 8)
|
||||
{
|
||||
@@ -205,6 +206,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
|
||||
description, shutdown_func, charset);
|
||||
if (tcl_current_script)
|
||||
{
|
||||
tcl_registered_script = tcl_current_script;
|
||||
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
@@ -218,7 +220,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
|
||||
{
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
|
||||
TCL_RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ int tcl_quiet = 0;
|
||||
struct t_plugin_script *tcl_scripts = NULL;
|
||||
struct t_plugin_script *last_tcl_script = NULL;
|
||||
struct t_plugin_script *tcl_current_script = NULL;
|
||||
struct t_plugin_script *tcl_registered_script = NULL;
|
||||
const char *tcl_current_script_filename = NULL;
|
||||
|
||||
/*
|
||||
@@ -181,6 +182,7 @@ weechat_tcl_load (const char *filename)
|
||||
}
|
||||
|
||||
tcl_current_script = NULL;
|
||||
tcl_registered_script = NULL;
|
||||
|
||||
if (!(interp = Tcl_CreateInterp ())) {
|
||||
weechat_printf (NULL,
|
||||
@@ -204,7 +206,7 @@ weechat_tcl_load (const char *filename)
|
||||
/* return 0; */
|
||||
}
|
||||
|
||||
if (!tcl_current_script)
|
||||
if (!tcl_registered_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: function \"register\" not "
|
||||
@@ -213,6 +215,7 @@ weechat_tcl_load (const char *filename)
|
||||
Tcl_DeleteInterp (interp);
|
||||
return 0;
|
||||
}
|
||||
tcl_current_script = tcl_registered_script;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ extern int tcl_quiet;
|
||||
extern struct t_plugin_script *tcl_scripts;
|
||||
extern struct t_plugin_script *last_tcl_script;
|
||||
extern struct t_plugin_script *tcl_current_script;
|
||||
extern struct t_plugin_script *tcl_registered_script;
|
||||
extern const char *tcl_current_script_filename;
|
||||
|
||||
extern void *weechat_tcl_exec (struct t_plugin_script *script,
|
||||
|
||||
Reference in New Issue
Block a user