From 0d76b6538132e8baa793d5a199cc14cddcaf7593 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 7 May 2002 23:03:30 +0000 Subject: non-zero return value in timeout and input handlers now stops it. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2757 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/perl/perl-sources.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/perl/perl-sources.c b/src/perl/perl-sources.c index be1a4188..06516474 100644 --- a/src/perl/perl-sources.c +++ b/src/perl/perl-sources.c @@ -64,6 +64,7 @@ static void perl_source_destroy(PERL_SOURCE_REC *rec) static int perl_source_event(PERL_SOURCE_REC *rec) { dSP; + int retcount; ENTER; SAVETMPS; @@ -73,14 +74,18 @@ static int perl_source_event(PERL_SOURCE_REC *rec) PUTBACK; perl_source_ref(rec); - perl_call_sv(rec->func, G_EVAL|G_DISCARD); + retcount = perl_call_sv(rec->func, G_EVAL|G_SCALAR); SPAGAIN; if (SvTRUE(ERRSV)) { char *error = g_strdup(SvPV(ERRSV, PL_na)); signal_emit("script error", 2, rec->script, error); g_free(error); + } else if (retcount > 0 && POPi != 0) { + /* stopped */ + perl_source_destroy(rec); } + perl_source_unref(rec); PUTBACK; -- cgit v1.2.3