fix: close sni menu on item destruction

This commit is contained in:
peelz
2025-09-16 14:03:45 -04:00
parent 41de8964f1
commit 0c3e82219f
2 changed files with 8 additions and 1 deletions

View File

@ -26,7 +26,7 @@ struct ToolTip {
class Item : public sigc::trackable {
public:
Item(const std::string&, const std::string&, const Json::Value&, const Bar&);
~Item() = default;
~Item();
std::string bus_name;
std::string object_path;

View File

@ -74,6 +74,13 @@ Item::Item(const std::string& bn, const std::string& op, const Json::Value& conf
cancellable_, interface);
}
Item::~Item() {
if (this->gtk_menu != nullptr) {
this->gtk_menu->popdown();
this->gtk_menu->detach();
}
}
bool Item::handleMouseEnter(GdkEventCrossing* const& e) {
event_box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
return false;