Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when a (timer) trigger is created by another trigger #189

nyfarn opened this Issue Sep 7, 2014 · 2 comments


None yet
2 participants
Copy link

nyfarn commented Sep 7, 2014

The following will crash WeeChat when the timer is triggered five seconds after a buffer switch.

/trigger add auto1 signal "buffer_switch" "" "" "/trigger addreplace timer timer 5000\;0\;1 \"\" \"\" \"/buffer 1\""

Here is the backtrace.

#0  0xb7348ddc in raise () from /lib/i386-linux-gnu/
No symbol table info available.
#1  0xb734a463 in abort () from /lib/i386-linux-gnu/
No symbol table info available.
#2  0x08062cd8 in weechat_shutdown (return_code=1, crash=1)
    at /home/flashcode/build/debian/weechat/src/core/weechat.c:489
No locals.
#3  0x0807cc18 in debug_sigsegv () at /home/flashcode/build/debian/weechat/src/core/wee-debug.c:175
No locals.
#4  <signal handler called>
No symbol table info available.
#5  0xb666f21c in trigger_callback_run_command (trigger=0x8dea920, buffer=0x88bb6d0, pointers=0x0,
    extra_vars=0x8deaef8, display_monitor=0)
    at /home/flashcode/build/debian/weechat/src/plugins/trigger/trigger-callback.c:274
        command_eval = 0x8deb1e8 "8de2e18,interpreter:0x8de2b28,description:0x8de2c90,next_script:0x8de2e70,author:0x8de2bb8,callbacks:0x8de2d70,unloading:0x8de2dd0,filename:0x8de2ae0,shutdown_func:0x8de2cd8,charset:0x8de2d28,version:"...
#6  0xb666f2ca in trigger_callback_execute (trigger=0x8dea920, buffer=0x0, pointers=0x0, extra_vars=0x8deaef8)
    at /home/flashcode/build/debian/weechat/src/plugins/trigger/trigger-callback.c:339
        display_monitor = 0
#7  0xb6670c7b in trigger_callback_timer_cb (data=0x8dea920, remaining_calls=0)
    at /home/flashcode/build/debian/weechat/src/plugins/trigger/trigger-callback.c:842
        str_temp = "2014-09-07 11:42:09\000\062\000\000\000p\000\000\000\070\a\202\bp\000\000\000@B\017\000\000\000\000\000@B\017\000\000\000\000\000\370Ɇ\b", '\000' <repeats 20 times>, "@B\017\000@B\017\000@B\017\000\000\000\000\000r(\fT*n\t\b@B\017\000\000\000\000\000@B\017", '\000' <repeats 13 times>, "\306\335\t"
        i = 0
        date = 1410082929
        date_tmp = 0x0
        extra_vars = 0x8deaef8
#8  0x08085f00 in hook_timer_exec () at /home/flashcode/build/debian/weechat/src/core/wee-hook.c:1173
        tv_time = {tv_sec = 1410082929, tv_usec = 755825}
        ptr_hook = 0x8deaa20
        next_hook = 0x0
#9  0x0809c2d2 in gui_main_loop () at /home/flashcode/build/debian/weechat/src/gui/curses/gui-curses-main.c:390
        tv_timeout = {tv_sec = 0, tv_usec = 0}
        read_fds = {fds_bits = {0 <repeats 32 times>}}
        write_fds = {fds_bits = {0 <repeats 32 times>}}
        except_fds = {fds_bits = {0 <repeats 32 times>}}
        max_fd = 0
        ready = 0
#10 0x08062765 in main (argc=3, argv=0xbfe64a44)
    at /home/flashcode/build/debian/weechat/src/gui/curses/main.c:41
No locals.

WeeChat 1.1-dev (git: v1.0-65-g9ab9e12) on Debian jessie

@flashcode flashcode added the bug label Sep 19, 2014

flashcode added a commit that referenced this issue Sep 20, 2014

@flashcode flashcode closed this in d1b4281 Sep 20, 2014


This comment has been minimized.

Copy link

flashcode commented Sep 20, 2014

Some notes about the fix I made: now the /trigger command can not change/delete a running trigger. So with your example, the command /trigger addreplace timer ... will fail because this command is triggered again by the /buffer 1 command.

I think it's not a good idea to create a trigger inside another trigger.

If you really want to do that, you can /mute the output, to not see the error (or the message when timer trigger is created):

/trigger add auto1 signal "buffer_switch" "" "" "/mute /trigger addreplace timer timer 5000\;0\;1 \"\" \"\" \"/buffer 1\""

Or you can use the /wait command:

/trigger add auto1 signal "buffer_switch" "" "" "/wait 5 /buffer 1"

@flashcode flashcode added this to the 1.0.1 milestone Sep 20, 2014

@flashcode flashcode self-assigned this Sep 20, 2014


This comment has been minimized.

Copy link

flashcode commented Sep 20, 2014

Moreover, be careful with your example, because the command /buffer 1 will send signal buffer_switch and then run your trigger again (you can have a loop with that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.