hexchat / hexchat

GTK+ IRC client
https://hexchat.github.io
GNU General Public License v2.0
3.08k stars 538 forks source link

Segmentation fault with channel filter script #2166

Open SoniEx2 opened 6 years ago

SoniEx2 commented 6 years ago
hexchat.register("Channel Filter", "1.0.0", "Filters channels")

local function on_open()
    print(hexchat.props["channel"], hexchat.props["network"])
    if hexchat.props["channel"] == "#hexchat" and hexchat.props["network"] == "freenode" then
        hexchat.command("close")
    end
end

hexchat.hook_print("Open Context", on_open)

Rather than keeping you from joining #hexchat, it just segfaults.

TingPing commented 6 years ago

The solution would be for new_ircwindow() to detect that and return NULL and for all callers to handle that somehow.

TingPing commented 6 years ago

A workaround would of course be hexchat.command("timer 1 close")

SoniEx2 commented 6 years ago

Does timer save the context?

SoniEx2 commented 6 years ago

Also, why not keep contexts alive until the main loop, and then clean up "closed" contexts while no plugins are running?

That way, it should also automatically fix #2161 #2160 #2167 and so on.

TingPing commented 6 years ago

Does timer save the context?

Yes the timer will run in the same context.

Also, why not keep contexts alive until the main loop, and then clean up "closed" contexts while no plugins are running?

I'm not necessarily against it if you want to submit a patch.

SoniEx2 commented 6 years ago

nvm keeping contexts alive - there's no "main loop".