Skip to content

Commit 193978c

Browse files
schodetvincentbernat
authored andcommitted
Do not use cookie with a zero value
This causes problems at least for xdg-desktop-portal-gtk, see flatpak/xdg-desktop-portal-gtk#528. Avoid the problem by not using zero value.
1 parent e14230e commit 193978c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

xssproxy.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,14 @@ uint32_t inhibit_request(const char *sender, const char *app_name)
152152
int i;
153153
for (i=0; i<app->cookies->len; i++)
154154
{
155-
if (i != g_array_index(app->cookies, uint32_t, i))
155+
if (i + 1 != g_array_index(app->cookies, uint32_t, i))
156156
{
157157
break;
158158
}
159159
}
160-
g_array_insert_val(app->cookies, i, i);
161-
return i;
160+
uint32_t cookie = i + 1;
161+
g_array_insert_val(app->cookies, i, cookie);
162+
return cookie;
162163
}
163164

164165
void handle_inhibit(DBusConnection *conn, DBusMessage *msg)

0 commit comments

Comments
 (0)