broadway: Don't cause traffic when disconnecting

The recently added transient-for support was causing
roundtrips when a client with transients disconnects,
leading to assertion failures. Avoid that.
This commit is contained in:
Matthias Clasen 2023-03-17 10:59:05 -04:00
parent fe2b6dd246
commit 88dd6e630e
3 changed files with 8 additions and 8 deletions

View File

@ -1574,7 +1574,8 @@ broadway_server_query_mouse (BroadwayServer *server,
void void
broadway_server_destroy_surface (BroadwayServer *server, broadway_server_destroy_surface (BroadwayServer *server,
int id) int id,
gboolean disconnected)
{ {
BroadwaySurface *surface; BroadwaySurface *surface;
gint32 transient_for = -1; gint32 transient_for = -1;
@ -1589,8 +1590,7 @@ broadway_server_destroy_surface (BroadwayServer *server,
server->pointer_grab_surface_id = -1; server->pointer_grab_surface_id = -1;
if (server->output) if (server->output)
broadway_output_destroy_surface (server->output, broadway_output_destroy_surface (server->output, id);
id);
surface = broadway_server_lookup_surface (server, id); surface = broadway_server_lookup_surface (server, id);
if (surface != NULL) if (surface != NULL)
@ -1604,7 +1604,7 @@ broadway_server_destroy_surface (BroadwayServer *server,
broadway_surface_free (server, surface); broadway_surface_free (server, surface);
} }
if (transient_for != -1) if (transient_for != -1 && !disconnected)
{ {
surface = broadway_server_lookup_surface (server, transient_for); surface = broadway_server_lookup_surface (server, transient_for);
if (surface != NULL) if (surface != NULL)

View File

@ -93,7 +93,8 @@ guint32 broadway_server_new_surface (BroadwayServer *
int width, int width,
int height); int height);
void broadway_server_destroy_surface (BroadwayServer *server, void broadway_server_destroy_surface (BroadwayServer *server,
int id); int id,
gboolean disconnected);
gboolean broadway_server_surface_show (BroadwayServer *server, gboolean broadway_server_surface_show (BroadwayServer *server,
int id); int id);
gboolean broadway_server_surface_hide (BroadwayServer *server, gboolean broadway_server_surface_hide (BroadwayServer *server,

View File

@ -101,8 +101,7 @@ client_disconnected (BroadwayClient *client)
} }
for (l = client->surfaces; l != NULL; l = l->next) for (l = client->surfaces; l != NULL; l = l->next)
broadway_server_destroy_surface (server, broadway_server_destroy_surface (server, GPOINTER_TO_UINT (l->data), TRUE);
GPOINTER_TO_UINT (l->data));
g_list_free (client->surfaces); g_list_free (client->surfaces);
client->surfaces = NULL; client->surfaces = NULL;
@ -268,7 +267,7 @@ client_handle_request (BroadwayClient *client,
client->surfaces = client->surfaces =
g_list_remove (client->surfaces, g_list_remove (client->surfaces,
GUINT_TO_POINTER (request->destroy_surface.id)); GUINT_TO_POINTER (request->destroy_surface.id));
broadway_server_destroy_surface (server, request->destroy_surface.id); broadway_server_destroy_surface (server, request->destroy_surface.id, FALSE);
break; break;
case BROADWAY_REQUEST_SHOW_SURFACE: case BROADWAY_REQUEST_SHOW_SURFACE:
broadway_server_surface_show (server, request->show_surface.id); broadway_server_surface_show (server, request->show_surface.id);