From 4a5358e8c58dd608c892514da5f7b51a63789411 Mon Sep 17 00:00:00 2001 From: Cole Leavitt Date: Wed, 17 Sep 2025 21:17:26 -0700 Subject: [PATCH 1/2] fix: handle null GDK window reference in surface initialization --- src/bar.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bar.cpp b/src/bar.cpp index f3468ff4..70029a2a 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -433,7 +433,18 @@ void waybar::Bar::onMap(GdkEventAny* /*unused*/) { /* * Obtain a pointer to the custom layer surface for modules that require it (idle_inhibitor). */ - auto* gdk_window = window.get_window()->gobj(); + auto gdk_window_ref = window.get_window(); + if (!gdk_window_ref) { + spdlog::warn("Failed to get GDK window during onMap, deferring surface initialization"); + return; + } + + auto* gdk_window = gdk_window_ref->gobj(); + if (!gdk_window) { + spdlog::warn("GDK window object is null during onMap, deferring surface initialization"); + return; + } + surface = gdk_wayland_window_get_wl_surface(gdk_window); configureGlobalOffset(gdk_window_get_width(gdk_window), gdk_window_get_height(gdk_window)); From 45cfaf4a0bb50b8eecb96a9f85016cd129e5fc80 Mon Sep 17 00:00:00 2001 From: Cole Leavitt Date: Wed, 17 Sep 2025 21:20:43 -0700 Subject: [PATCH 2/2] fix: validate 'swap-icon-label' configuration type and log warnings --- src/AIconLabel.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/AIconLabel.cpp b/src/AIconLabel.cpp index 79cd5fe1..a20c22e9 100644 --- a/src/AIconLabel.cpp +++ b/src/AIconLabel.cpp @@ -36,10 +36,13 @@ AIconLabel::AIconLabel(const Json::Value &config, const std::string &name, const box_.set_spacing(spacing); bool swap_icon_label = false; - if (not config_["swap-icon-label"].isBool()) - spdlog::warn("'swap-icon-label' must be a bool."); - else + if (config_["swap-icon-label"].isNull()) { + } else if (config_["swap-icon-label"].isBool()) { swap_icon_label = config_["swap-icon-label"].asBool(); + } else { + spdlog::warn("'swap-icon-label' must be a bool, found '{}'. Using default value (false).", + config_["swap-icon-label"].asString()); + } if ((rot == 0 || rot == 3) ^ swap_icon_label) { box_.add(image_);