service/tray: log menu refcount updates

This commit is contained in:
outfoxxed committed 2024-07-02 10:50:07 -07:00
1 parent ec362637b8
commit b4be383695
1 file changed
+6
+6
View File
@@ -31,6 +31,7 @@ using namespace qs::dbus;
using namespace qs::dbus::dbusmenu;
Q_LOGGING_CATEGORY(logStatusNotifierItem, "quickshell.service.sni.item", QtWarningMsg);
Q_LOGGING_CATEGORY(logSniMenu, "quickshell.service.sni.item.menu", QtWarningMsg);
namespace qs::service::sni {
@@ -235,6 +236,7 @@ DBusMenu* StatusNotifierItem::menu() const { return this->mMenu; }
void StatusNotifierItem::refMenu() {
this->menuRefcount++;
qCDebug(logSniMenu) << "Menu of" << this << "gained a reference. Refcount is now" << this->menuRefcount;
if (this->menuRefcount == 1) {
this->onMenuPathChanged();
@@ -247,6 +249,7 @@ void StatusNotifierItem::refMenu() {
void StatusNotifierItem::unrefMenu() {
this->menuRefcount--;
qCDebug(logSniMenu) << "Menu of" << this << "lost a reference. Refcount is now" << this->menuRefcount;
if (this->menuRefcount == 0) {
this->onMenuPathChanged();
@@ -254,6 +257,9 @@ void StatusNotifierItem::unrefMenu() {
}
void StatusNotifierItem::onMenuPathChanged() {
qCDebug(logSniMenu) << "Updating menu of" << this << "with refcount" << this->menuRefcount
<< "path" << this->menuPath.get().path();
if (this->mMenu) {
this->mMenu->deleteLater();
this->mMenu = nullptr;