forked from quickshell/quickshell
		
	service/tray: log menu refcount updates
This commit is contained in:
		
							parent
							
								
									ec362637b8
								
							
						
					
					
						commit
						b4be383695
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -31,6 +31,7 @@ using namespace qs::dbus;
 | 
				
			||||||
using namespace qs::dbus::dbusmenu;
 | 
					using namespace qs::dbus::dbusmenu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Q_LOGGING_CATEGORY(logStatusNotifierItem, "quickshell.service.sni.item", QtWarningMsg);
 | 
					Q_LOGGING_CATEGORY(logStatusNotifierItem, "quickshell.service.sni.item", QtWarningMsg);
 | 
				
			||||||
 | 
					Q_LOGGING_CATEGORY(logSniMenu, "quickshell.service.sni.item.menu", QtWarningMsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace qs::service::sni {
 | 
					namespace qs::service::sni {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -235,6 +236,7 @@ DBusMenu* StatusNotifierItem::menu() const { return this->mMenu; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StatusNotifierItem::refMenu() {
 | 
					void StatusNotifierItem::refMenu() {
 | 
				
			||||||
	this->menuRefcount++;
 | 
						this->menuRefcount++;
 | 
				
			||||||
 | 
						qCDebug(logSniMenu) << "Menu of" << this << "gained a reference. Refcount is now" << this->menuRefcount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->menuRefcount == 1) {
 | 
						if (this->menuRefcount == 1) {
 | 
				
			||||||
		this->onMenuPathChanged();
 | 
							this->onMenuPathChanged();
 | 
				
			||||||
| 
						 | 
					@ -247,6 +249,7 @@ void StatusNotifierItem::refMenu() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StatusNotifierItem::unrefMenu() {
 | 
					void StatusNotifierItem::unrefMenu() {
 | 
				
			||||||
	this->menuRefcount--;
 | 
						this->menuRefcount--;
 | 
				
			||||||
 | 
						qCDebug(logSniMenu) << "Menu of" << this << "lost a reference. Refcount is now" << this->menuRefcount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->menuRefcount == 0) {
 | 
						if (this->menuRefcount == 0) {
 | 
				
			||||||
		this->onMenuPathChanged();
 | 
							this->onMenuPathChanged();
 | 
				
			||||||
| 
						 | 
					@ -254,6 +257,9 @@ void StatusNotifierItem::unrefMenu() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StatusNotifierItem::onMenuPathChanged() {
 | 
					void StatusNotifierItem::onMenuPathChanged() {
 | 
				
			||||||
 | 
						qCDebug(logSniMenu) << "Updating menu of" << this << "with refcount" << this->menuRefcount
 | 
				
			||||||
 | 
																<< "path" << this->menuPath.get().path();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->mMenu) {
 | 
						if (this->mMenu) {
 | 
				
			||||||
		this->mMenu->deleteLater();
 | 
							this->mMenu->deleteLater();
 | 
				
			||||||
		this->mMenu = nullptr;
 | 
							this->mMenu = nullptr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue