mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
onscreen/native: Hold ref to the output and CRTC until detached
When an onscreen is "attached" it means it has an active CRTC and output it interacts with, e.g. listens to configuration changes to update gamma and privacy screen state. MetaOutput and MetaCrtc are rather short lived objects meaning they are disposed of and regenerated each time the compositor reloads monitor resources, and while MetaOutput are indirectly kept alive due to the MetaMonitor holding on to them during reloading, the same does not apply to MetaCrtc, so to avoid trying to disconnect our signals from disappeared outputs and CRTCs when we dispatch, hold our own references to these objects. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2665 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2885>
This commit is contained in:
parent
d1785a3917
commit
08593ea872
@ -2251,8 +2251,9 @@ meta_onscreen_native_new (MetaRendererNative *renderer_native,
|
|||||||
|
|
||||||
onscreen_native->renderer_native = renderer_native;
|
onscreen_native->renderer_native = renderer_native;
|
||||||
onscreen_native->render_gpu = render_gpu;
|
onscreen_native->render_gpu = render_gpu;
|
||||||
onscreen_native->output = output;
|
|
||||||
onscreen_native->crtc = crtc;
|
g_set_object (&onscreen_native->output, output);
|
||||||
|
g_set_object (&onscreen_native->crtc, crtc);
|
||||||
|
|
||||||
if (meta_crtc_get_gamma_lut_size (crtc) > 0)
|
if (meta_crtc_get_gamma_lut_size (crtc) > 0)
|
||||||
{
|
{
|
||||||
@ -2368,4 +2369,6 @@ void
|
|||||||
meta_onscreen_native_detach (MetaOnscreenNative *onscreen_native)
|
meta_onscreen_native_detach (MetaOnscreenNative *onscreen_native)
|
||||||
{
|
{
|
||||||
clear_invalidation_handlers (onscreen_native);
|
clear_invalidation_handlers (onscreen_native);
|
||||||
|
g_clear_object (&onscreen_native->output);
|
||||||
|
g_clear_object (&onscreen_native->crtc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user