mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-11-04 03:36:32 +00:00
service/tray: log menu refcount updates
This commit is contained in:
1 file changed
+6
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user