mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
kms-impl/simple: Fix page_flip_data ref leak on fallback
If drmModePageFlip() or custom_page_flip_func fails, process_page_flip() was
forgetting to undo the ref taken for that call. This would leak page_flip_data.
The reference counting works like this:
- when created, ref count is 1
- when calling drmModePageFlip, ref count is increased to 2
- new: if flip failed, ref count is decreased back to 1
- if calling schedule_retry_page_flip(), it takes a ref internally
- if calling mode_set_fallback(), it takes a ref internally
- all return FALSE paths have an explicit unref
- return TRUE path has an explicit unref
This issue was found by code inspection and while debugging an unrelated issue
with debug prints sprinkled around. I am not aware of any end-user visible
issues being fixed by this, as the leak is small and probably very rare.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1209
(cherry picked from commit 36111270aa
)
This commit is contained in:
parent
a62fe66a25
commit
06b0d41baf
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2019 Red Hat
|
* Copyright (C) 2018-2019 Red Hat
|
||||||
* Copyright (C) 2019 DisplayLink (UK) Ltd.
|
* Copyright (C) 2019-2020 DisplayLink (UK) Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License as
|
* modify it under the terms of the GNU General Public License as
|
||||||
@ -660,6 +660,9 @@ process_page_flip (MetaKmsImpl *impl,
|
|||||||
meta_kms_page_flip_data_ref (page_flip_data));
|
meta_kms_page_flip_data_ref (page_flip_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret != 0)
|
||||||
|
meta_kms_page_flip_data_unref (page_flip_data);
|
||||||
|
|
||||||
if (ret == -EBUSY)
|
if (ret == -EBUSY)
|
||||||
{
|
{
|
||||||
CachedModeSet *cached_mode_set;
|
CachedModeSet *cached_mode_set;
|
||||||
|
Loading…
Reference in New Issue
Block a user