Merge pull request #4485 from coleleavitt/master

fix: handle null GDK window reference in surface initialization
This commit is contained in:
Alexis Rouillard
2025-10-01 14:13:33 +02:00
committed by GitHub
2 changed files with 18 additions and 4 deletions

View File

@ -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_);

View File

@ -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));