summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Amelia Chen <hi@pluie.me>2025-08-18 10:56:06 +0800
committerGitHub <noreply@github.com>2025-08-18 10:56:06 +0800
commit0f7b559f0f32e588195344b768ae291b2d5c7edc (patch)
tree496b043f04b4cc73b26a9be78bcded54a5816db1
parent02a942cf72a5d7b61d6537413ead4cb9823267f2 (diff)
parent7f8d215955844d91b29ac4016d7379f5d228f3c6 (diff)
gtk-ng: fix race condition when checking border bell feature (#8267)
-rw-r--r--src/apprt/gtk-ng/class/surface.zig14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/apprt/gtk-ng/class/surface.zig b/src/apprt/gtk-ng/class/surface.zig
index 580436bd3..b412d6b6b 100644
--- a/src/apprt/gtk-ng/class/surface.zig
+++ b/src/apprt/gtk-ng/class/surface.zig
@@ -554,13 +554,21 @@ pub const Surface = extern struct {
config_: ?*Config,
bell_ringing_: c_int,
) callconv(.c) c_int {
+ const bell_ringing = bell_ringing_ != 0;
+
+ // If the bell isn't ringing exit early because when the surface is
+ // first created there's a race between this code being run and the
+ // config being set on the surface. That way we don't overwhelm people
+ // with the warning that we issue if the config isn't set and overwhelm
+ // ourselves with large numbers of bug reports.
+ if (!bell_ringing) return @intFromBool(false);
+
const config = if (config_) |v| v.get() else {
- log.warn("config unavailable for computing whether border should be shown , likely bug", .{});
+ log.warn("config unavailable for computing whether border should be shown, likely bug", .{});
return @intFromBool(false);
};
- const bell_ringing = bell_ringing_ != 0;
- return @intFromBool(config.@"bell-features".border and bell_ringing);
+ return @intFromBool(config.@"bell-features".border);
}
pub fn toggleFullscreen(self: *Self) void {