Merge pull request #2004 from bwaite/fix-memory-leak-upower

This commit is contained in:
Alex 2023-02-08 09:02:06 +01:00 committed by GitHub
commit d25930793c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -85,6 +85,12 @@ int main(int argc, char* argv[]) {
waybar::Client::inst()->reset(); waybar::Client::inst()->reset();
}); });
std::signal(SIGINT, [](int /*signal*/) {
spdlog::info("Quitting.");
reload = false;
waybar::Client::inst()->reset();
});
for (int sig = SIGRTMIN + 1; sig <= SIGRTMAX; ++sig) { for (int sig = SIGRTMIN + 1; sig <= SIGRTMAX; ++sig) {
std::signal(sig, [](int sig) { std::signal(sig, [](int sig) {
for (auto& bar : waybar::Client::inst()->bars) { for (auto& bar : waybar::Client::inst()->bars) {

View File

@ -29,7 +29,7 @@ UPowerTooltip::~UPowerTooltip() {}
uint UPowerTooltip::updateTooltip(Devices& devices) { uint UPowerTooltip::updateTooltip(Devices& devices) {
// Removes all old devices // Removes all old devices
for (auto child : contentBox->get_children()) { for (auto child : contentBox->get_children()) {
child->~Widget(); delete child;
} }
uint deviceCount = 0; uint deviceCount = 0;