fix: double free / uncatched errors
This commit is contained in:
@@ -939,7 +939,7 @@ void Workspaces::sortWorkspaces() {
|
|||||||
case SortMethod::NUMBER:
|
case SortMethod::NUMBER:
|
||||||
try {
|
try {
|
||||||
return std::stoi(a->name()) < std::stoi(b->name());
|
return std::stoi(a->name()) < std::stoi(b->name());
|
||||||
} catch (const std::invalid_argument&) {
|
} catch (const std::exception& e) {
|
||||||
// Handle the exception if necessary.
|
// Handle the exception if necessary.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ Item::~Item() {
|
|||||||
this->gtk_menu->popdown();
|
this->gtk_menu->popdown();
|
||||||
this->gtk_menu->detach();
|
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) {
|
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);
|
std::string custom_icon = IconManager::instance().getIconForApp(id);
|
||||||
if (!custom_icon.empty()) {
|
if (!custom_icon.empty()) {
|
||||||
if (std::filesystem::exists(custom_icon)) {
|
if (std::filesystem::exists(custom_icon)) {
|
||||||
Glib::RefPtr<Gdk::Pixbuf> custom_pixbuf = Gdk::Pixbuf::create_from_file(custom_icon);
|
try {
|
||||||
icon_name = ""; // icon_name has priority over pixmap
|
Glib::RefPtr<Gdk::Pixbuf> custom_pixbuf = Gdk::Pixbuf::create_from_file(custom_icon);
|
||||||
icon_pixmap = custom_pixbuf;
|
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
|
} else { // if file doesn't exist it's most likely an icon_name
|
||||||
icon_name = custom_icon;
|
icon_name = custom_icon;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user