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

Fix SEGFAULT in battery module #2184

Merged
merged 1 commit into from
May 22, 2023
Merged

Fix SEGFAULT in battery module #2184

merged 1 commit into from
May 22, 2023

Conversation

lfos
Copy link
Contributor

@lfos lfos commented May 22, 2023

In waybar::modules::Battery::~Battery(), store a copy of the batteries_ iterator before calling erase(), as erase() invalidates the iterator.

Prior to this change, disconnecting outputs resulted in a SEGFAULT when using the battery module; e.g.,

[debug] Received SIGCHLD in signalThread
[debug] Cmd exited with code 0
[debug] Received SIGCHLD in signalThread
[debug] Cmd exited with code 0
[debug] Received SIGCHLD in signalThread
[debug] Cmd exited with code 0
[debug] Output removed: AU Optronics 0x2336
[info] Bar configured (width: 1280, height: 25) for output: eDP-1
[info] Bar configured (width: 1280, height: 25) for output: eDP-1
zsh: segmentation fault (core dumped)  ./build/waybar -l trace

In waybar::modules::Battery::~Battery(), store a copy of the batteries_
iterator before calling erase(), as erase() invalidates the iterator.

Prior to this change, disconnecting outputs resulted in a SEGFAULT when
using the battery module; e.g.,

    [debug] Received SIGCHLD in signalThread
    [debug] Cmd exited with code 0
    [debug] Received SIGCHLD in signalThread
    [debug] Cmd exited with code 0
    [debug] Received SIGCHLD in signalThread
    [debug] Cmd exited with code 0
    [debug] Output removed: AU Optronics 0x2336
    [info] Bar configured (width: 1280, height: 25) for output: eDP-1
    [info] Bar configured (width: 1280, height: 25) for output: eDP-1
    zsh: segmentation fault (core dumped)  ./build/waybar -l trace

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
@Alexays Alexays merged commit 7b0d2e8 into Alexays:master May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants