gtk-ng: fix race condition when checking border bell feature
Fixes #8266 When a surface is first created, there's a race condition between when the config is set on the surface and when the code to check if a border should be drawn around the surface is run. Fix that by exiting early if the bell isn't ringing, before we check to see if there's a config set on the surface and issuing the warning message.pull/8267/head
parent
11d56235f9
commit
7f8d215955
|
|
@ -554,13 +554,21 @@ pub const Surface = extern struct {
|
||||||
config_: ?*Config,
|
config_: ?*Config,
|
||||||
bell_ringing_: c_int,
|
bell_ringing_: c_int,
|
||||||
) callconv(.c) 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 {
|
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);
|
return @intFromBool(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const bell_ringing = bell_ringing_ != 0;
|
return @intFromBool(config.@"bell-features".border);
|
||||||
return @intFromBool(config.@"bell-features".border and bell_ringing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggleFullscreen(self: *Self) void {
|
pub fn toggleFullscreen(self: *Self) void {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue