mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-18 07:34:54 +00:00
animation: Stop the animation before removing all the children
If the resource scale or the scale factor changes while the animation is playing, we need to stop the animation and start it again once the texture is loaded, as the idle might try to access an invalidated animation child otherwise. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700
This commit is contained in:
parent
9e388ebcfd
commit
ea4d5f89eb
1 changed files with 11 additions and 1 deletions
|
|
@ -54,12 +54,19 @@ var Animation = class {
|
|||
|
||||
_loadFile(file, width, height) {
|
||||
let [validResourceScale, resourceScale] = this.actor.get_resource_scale();
|
||||
let wasPlaying = this._isPlaying;
|
||||
|
||||
if (this._isPlaying)
|
||||
this.stop();
|
||||
|
||||
this._isLoaded = false;
|
||||
this.actor.destroy_all_children();
|
||||
|
||||
if (!validResourceScale)
|
||||
if (!validResourceScale) {
|
||||
if (wasPlaying)
|
||||
this.play();
|
||||
return;
|
||||
}
|
||||
|
||||
let textureCache = St.TextureCache.get_default();
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
|
|
@ -67,6 +74,9 @@ var Animation = class {
|
|||
scaleFactor, resourceScale,
|
||||
this._animationsLoaded.bind(this));
|
||||
this.actor.set_child(this._animations);
|
||||
|
||||
if (wasPlaying)
|
||||
this.play();
|
||||
}
|
||||
|
||||
_showFrame(frame) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue