Skip to content

Commit

Permalink
fix time miscalculation in notification removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Aug 18, 2024
1 parent 0e8cc9c commit a0fb257
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,9 @@ void BetterInfo::showUnimportantNotification(const std::string& content, Notific
notif->show();

std::thread([notif, time] {
//assume up to 2 notifications are scheduled outside of this - if this fails nothing much really happens, they just wont be removed immediately
std::this_thread::sleep_for(std::chrono::seconds((int) (time + (s_notifications.size() + 2))));
//assume up to 4 notifications are scheduled outside of this - if this fails nothing much really happens, they just wont be removed immediately
//assume notifications are not longer than 5s
std::this_thread::sleep_for(std::chrono::seconds((int) (5 * (s_notifications.size() + 4))));
Loader::get()->queueInMainThread([notif] {
s_notifications.erase(std::remove(s_notifications.begin(), s_notifications.end(), notif), s_notifications.end());
});
Expand Down

0 comments on commit a0fb257

Please sign in to comment.