mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 16:05:58 +01:00
Fix UAF in animation end callback if callback deletes the animation (#2389)
Removes use after free when the end callback deletes the animation as long as `m_bRemoveEndAfterRan` is false.
This commit is contained in:
parent
438d063ec6
commit
409ff027f8
1 changed files with 3 additions and 1 deletions
|
@ -268,8 +268,10 @@ class CAnimatedVariable {
|
|||
// methods
|
||||
void onAnimationEnd() {
|
||||
if (m_fEndCallback) {
|
||||
// loading m_bRemoveEndAfterRan before calling the callback allows the callback to delete this animation safely if it is false.
|
||||
auto removeEndCallback = m_bRemoveEndAfterRan;
|
||||
m_fEndCallback(this);
|
||||
if (m_bRemoveEndAfterRan)
|
||||
if (removeEndCallback)
|
||||
m_fEndCallback = nullptr; // reset
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue