diff --git a/src/modules/hyprland/workspaces.cpp b/src/modules/hyprland/workspaces.cpp index 3bbe47df..6fa38260 100644 --- a/src/modules/hyprland/workspaces.cpp +++ b/src/modules/hyprland/workspaces.cpp @@ -939,7 +939,7 @@ void Workspaces::sortWorkspaces() { case SortMethod::NUMBER: try { return std::stoi(a->name()) < std::stoi(b->name()); - } catch (const std::invalid_argument&) { + } catch (const std::exception& e) { // Handle the exception if necessary. break; } diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index 398afac6..ef2543b5 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -79,6 +79,10 @@ Item::~Item() { this->gtk_menu->popdown(); this->gtk_menu->detach(); } + if (this->dbus_menu != nullptr) { + g_object_weak_unref(G_OBJECT(this->dbus_menu), (GWeakNotify)onMenuDestroyed, this); + this->dbus_menu = nullptr; + } } bool Item::handleMouseEnter(GdkEventCrossing* const& e) { @@ -233,9 +237,13 @@ void Item::setCustomIcon(const std::string& id) { std::string custom_icon = IconManager::instance().getIconForApp(id); if (!custom_icon.empty()) { if (std::filesystem::exists(custom_icon)) { - Glib::RefPtr custom_pixbuf = Gdk::Pixbuf::create_from_file(custom_icon); - icon_name = ""; // icon_name has priority over pixmap - icon_pixmap = custom_pixbuf; + try { + Glib::RefPtr custom_pixbuf = Gdk::Pixbuf::create_from_file(custom_icon); + icon_name = ""; // icon_name has priority over pixmap + icon_pixmap = custom_pixbuf; + } catch (const Glib::Error& e) { + spdlog::error("Failed to load custom icon {}: {}", custom_icon, e.what()); + } } else { // if file doesn't exist it's most likely an icon_name icon_name = custom_icon; }