screen-cast-stream: Also release mapping id when clearing stream

Use the previously added API to release acquired mapping ids, when the
corresponding stream is destroyed.
Otherwise, the remote desktop session would maintain a whole bunch of
unused mapping ids, as their corresponding streams are already
destroyed, but maybe not the session.
Such situation would be a remote multimonitor session, where the amount
of used virtual monitors changes multiple times during the session.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3273>
This commit is contained in:
Pascal Nowack 2023-09-12 13:17:27 +02:00
parent 3461e1e18c
commit 83454e944b

View File

@ -324,10 +324,19 @@ meta_screen_cast_stream_finalize (GObject *object)
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (object);
MetaScreenCastStreamPrivate *priv =
meta_screen_cast_stream_get_instance_private (stream);
MetaRemoteDesktopSession *remote_desktop_session;
if (priv->src)
meta_screen_cast_stream_close (stream);
remote_desktop_session =
meta_screen_cast_session_get_remote_desktop_session (priv->session);
if (remote_desktop_session && priv->mapping_id)
{
meta_remote_desktop_session_release_mapping_id (remote_desktop_session,
priv->mapping_id);
}
g_clear_pointer (&priv->object_path, g_free);
g_clear_pointer (&priv->mapping_id, g_free);