core: handle null timers in destructors (#350)

This commit is contained in:
André Silva 2024-05-26 18:46:53 +02:00 committed by GitHub
parent 58c93d8de8
commit 768cd3ea52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -5,8 +5,10 @@
#include <cmath> #include <cmath>
CImage::~CImage() { CImage::~CImage() {
if (imageTimer) {
imageTimer->cancel(); imageTimer->cancel();
imageTimer.reset(); imageTimer.reset();
}
} }
static void onTimer(std::shared_ptr<CTimer> self, void* data) { static void onTimer(std::shared_ptr<CTimer> self, void* data) {

View file

@ -6,8 +6,10 @@
#include "../../core/hyprlock.hpp" #include "../../core/hyprlock.hpp"
CLabel::~CLabel() { CLabel::~CLabel() {
if (labelTimer) {
labelTimer->cancel(); labelTimer->cancel();
labelTimer.reset(); labelTimer.reset();
}
} }
static void onTimer(std::shared_ptr<CTimer> self, void* data) { static void onTimer(std::shared_ptr<CTimer> self, void* data) {