Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix splash screen by delay destroy #7270

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions cocos/core/splash-screen.ts
Expand Up @@ -19,8 +19,10 @@ import { legacyCC } from './global-exports';
import { Root } from './root';
import { DSPool, ShaderPool, PassPool, PassView } from './renderer/core/memory-pools';
import { SetIndex } from './pipeline/define';
import { GFXBufferTextureCopy, GFXBufferUsageBit, GFXCommandBufferType, GFXFormat,
GFXMemoryUsageBit, GFXTextureType, GFXTextureUsageBit, GFXRect, GFXColor, GFXAddress } from './gfx/define';
import {
GFXBufferTextureCopy, GFXBufferUsageBit, GFXCommandBufferType, GFXFormat,
GFXMemoryUsageBit, GFXTextureType, GFXTextureUsageBit, GFXRect, GFXColor, GFXAddress
} from './gfx/define';

export type SplashEffectType = 'NONE' | 'FADE-INOUT';

Expand Down Expand Up @@ -222,7 +224,8 @@ export class SplashScreen {
private hide () {
cancelAnimationFrame(this.handle);
this.cancelAnimate = true;
this.destoy();
// here delay destroy:because ios immediately destroy input assmebler will crash & native renderer will mess.
setTimeout(this.destroy.bind(this));
}

private frame (time: number) {
Expand Down Expand Up @@ -507,7 +510,7 @@ export class SplashScreen {
device.copyTexImagesToTexture([this.image!], this.texture, [this.region]);
}

private destoy () {
private destroy () {
this.callBack = null;
this.clearColors = null!;
this.device = null!;
Expand All @@ -527,7 +530,7 @@ export class SplashScreen {
this.texture.destroy();
this.texture = null!;

// this.assmebler.destroy(); // iOS crash workaround
this.assmebler.destroy();
this.assmebler = null!;

this.vertexBuffers.destroy();
Expand Down