Skip to content
This repository was archived by the owner on Apr 17, 2020. It is now read-only.
This repository was archived by the owner on Apr 17, 2020. It is now read-only.

missed redraws due to concurrency error #827

@irssibot

Description

@irssibot

There's a concurrency error between sig_winch() and check_dirty() that results in the screen not being redrawn when it should be.

To be more precise, in src/fe-text/irssi.c we have

    void irssi_set_dirty(void)
    {
        dirty = TRUE;
    }

    static void dirty_check(void)
    {
        if (!dirty || dummy)
            return;

        // ... Do redraw stuff ...

        dirty = FALSE;
    }

and in src/fe-text/term.c we have

    static void sig_winch(int p)
    {
        irssi_set_dirty();
        resize_dirty = TRUE;
    }

The problem is that dirty_check() might be in the middle of a redraw when the winch signal comes in, at which point sig_winch sets dirty = TRUE. Then, after dirty_check() is done with its (now out of date) redraw, it sets dirty back to FALSE. Hence the required redraw never occurs.

I've fixed this for now (patch attached) by moving dirty = FALSE in dirty_check to before the redraw stuff takes place, reasoning that a redundant redraw is less worse than a missed redraw (which leaves the screen in a mess on my machines).

I guess really there should be some locking on the dirty variable, but maybe that's a bit heavy weight...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions