1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-23 03:16:37 +02:00

python: fix interpreter used after unload of a script

This commit is contained in:
Sebastien Helleu
2014-02-17 21:56:21 +01:00
parent 652ec24449
commit 5ac3d538b8
2 changed files with 5 additions and 4 deletions
+4 -4
View File
@@ -795,7 +795,6 @@ weechat_python_unload (struct t_plugin_script *script)
{
int *rc;
void *interpreter;
PyThreadState *old_interpreter;
char *filename;
if ((weechat_python_plugin->debug >= 2) || !python_quiet)
@@ -814,12 +813,13 @@ weechat_python_unload (struct t_plugin_script *script)
}
filename = strdup (script->filename);
old_interpreter = PyThreadState_Swap (NULL);
interpreter = script->interpreter;
if (python_current_script == script)
{
python_current_script = (python_current_script->prev_script) ?
python_current_script->prev_script : python_current_script->next_script;
}
plugin_script_remove (weechat_python_plugin, &python_scripts, &last_python_script,
script);
@@ -830,8 +830,8 @@ weechat_python_unload (struct t_plugin_script *script)
Py_EndInterpreter (interpreter);
}
if (old_interpreter)
PyThreadState_Swap (old_interpreter);
if (python_current_script)
PyThreadState_Swap (python_current_script->interpreter);
(void) weechat_hook_signal_send ("python_script_unloaded",
WEECHAT_HOOK_SIGNAL_STRING, filename);