diff options
author | Timo Sirainen <cras@irssi.org> | 2002-01-10 17:36:41 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-01-10 17:36:41 +0000 |
commit | 7131ceb909c5ffc614a8a9b40e80449a468fd78c (patch) | |
tree | cb5b82866eacd95be4fefee73701d9ecc2237ecb /src/perl | |
parent | 4032addbf93d6c5a66ed030579f6be89ead281ac (diff) | |
download | irssi-7131ceb909c5ffc614a8a9b40e80449a468fd78c.zip |
g_strdup() the error message before emitting "script error" signal, since
perl scripting might be executed during that signal and it clears the error
message.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2302 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/perl')
-rw-r--r-- | src/perl/perl-core.c | 5 | ||||
-rw-r--r-- | src/perl/perl-signals.c | 4 | ||||
-rw-r--r-- | src/perl/perl-sources.c | 5 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index 7af06f89..966c9b4f 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -242,8 +242,11 @@ static int perl_script_eval(PERL_SCRIPT_REC *script) if (error != NULL) { if (*error == '\0') error = NULL; - else + else { + error = g_strdup(error); signal_emit("script error", 2, script, error); + g_free(error); + } } PUTBACK; diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index 97d3828e..eb3a8b48 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -160,7 +160,9 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func, SPAGAIN; if (SvTRUE(ERRSV)) { - signal_emit("script error", 2, script, SvPV(ERRSV, PL_na)); + char *error = g_strdup(SvPV(ERRSV, PL_na)); + signal_emit("script error", 2, script, error); + g_free(error); rec = NULL; } diff --git a/src/perl/perl-sources.c b/src/perl/perl-sources.c index cedc472c..be1a4188 100644 --- a/src/perl/perl-sources.c +++ b/src/perl/perl-sources.c @@ -77,8 +77,9 @@ static int perl_source_event(PERL_SOURCE_REC *rec) SPAGAIN; if (SvTRUE(ERRSV)) { - signal_emit("script error", 2, rec->script, - SvPV(ERRSV, PL_na)); + char *error = g_strdup(SvPV(ERRSV, PL_na)); + signal_emit("script error", 2, rec->script, error); + g_free(error); } perl_source_unref(rec); |