Merge pull request #4485 from coleleavitt/master
fix: handle null GDK window reference in surface initialization
This commit is contained in:
@ -36,10 +36,13 @@ AIconLabel::AIconLabel(const Json::Value &config, const std::string &name, const
|
|||||||
box_.set_spacing(spacing);
|
box_.set_spacing(spacing);
|
||||||
|
|
||||||
bool swap_icon_label = false;
|
bool swap_icon_label = false;
|
||||||
if (not config_["swap-icon-label"].isBool())
|
if (config_["swap-icon-label"].isNull()) {
|
||||||
spdlog::warn("'swap-icon-label' must be a bool.");
|
} else if (config_["swap-icon-label"].isBool()) {
|
||||||
else
|
|
||||||
swap_icon_label = config_["swap-icon-label"].asBool();
|
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) {
|
if ((rot == 0 || rot == 3) ^ swap_icon_label) {
|
||||||
box_.add(image_);
|
box_.add(image_);
|
||||||
|
13
src/bar.cpp
13
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).
|
* 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);
|
surface = gdk_wayland_window_get_wl_surface(gdk_window);
|
||||||
configureGlobalOffset(gdk_window_get_width(gdk_window), gdk_window_get_height(gdk_window));
|
configureGlobalOffset(gdk_window_get_width(gdk_window), gdk_window_get_height(gdk_window));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user