diff --git a/src/dbus/tray/tray_service.cpp b/src/dbus/tray/tray_service.cpp index a821fa09a..3bef97441 100644 --- a/src/dbus/tray/tray_service.cpp +++ b/src/dbus/tray/tray_service.cpp @@ -341,12 +341,6 @@ namespace { return true; } - const std::vector& requestedMenuProperties() { - // Per dbusmenu protocol, an empty property list means "all available properties". - static const std::vector kRequestedMenuProperties = {}; - return kRequestedMenuProperties; - } - std::vector int32ListFromVariant(const sdbus::Variant& value) { try { return value.get>(); @@ -663,7 +657,8 @@ bool TrayService::fetchMenuProperties(const std::string& itemId, const std::vect cache.proxy->callMethod("GetGroupProperties") .onInterface(k_menu_interface) .withTimeout(std::chrono::milliseconds(1000)) - .withArguments(entryIds, requestedMenuProperties()) + // Per dbusmenu protocol, an empty property list means "all available properties". + .withArguments(entryIds, std::vector{}) .storeResultsTo(properties); std::unordered_map> propertiesById; @@ -777,7 +772,8 @@ void TrayService::requestMenuLayoutAfterAboutToShow(const std::string& itemId, s cache.proxy->callMethodAsync("GetLayout") .onInterface(k_menu_interface) .withTimeout(std::chrono::milliseconds(2000)) - .withArguments(parentId, static_cast(-1), requestedMenuProperties()) + // Per dbusmenu protocol, an empty property list means "all available properties". + .withArguments(parentId, static_cast(-1), std::vector{}) .uponReplyInvoke([this, itemId, parentId, generation](std::optional error, std::uint32_t revision, DbusMenuLayout layout) { auto replyCacheIt = m_menuCache.find(itemId); @@ -965,6 +961,8 @@ void TrayService::ensureMenuCache(const std::string& itemId, const std::string& cache.rootLoaded = false; // Allow a fresh root AboutToShow after provider-side resets. cache.rootAboutToShowPrimed = false; + // Bump generation to discard any in-flight GetLayout replies captured before this invalidation. + ++cache.generation; if (hadVisibleRootEntries) { kLog.debug("LayoutUpdated root soft-invalidated without emit id={} rev={} parent={}", itemId, revision, @@ -978,6 +976,8 @@ void TrayService::ensureMenuCache(const std::string& itemId, const std::string& cache.loadingParents.erase(parent); cache.nextRetryAt.erase(parent); cache.failureStreak.erase(parent); + // Bump generation to discard any in-flight GetLayout replies captured before this invalidation. + ++cache.generation; } } kLog.debug("LayoutUpdated id={} rev={} parent={}", itemId, revision, parent);