【2.0.9】场景切换(通过空场景过渡),通用资源使用异常(已结)

  • Creator 版本:2.0.9

  • 目标平台: 模拟器,Web

  • 详细报错信息,包含调用堆栈:

  • 重现方式:
    1.在场景A设置资源自动回收,放置按钮使用资源BtnA
    2.切换到过渡场景B,过渡场景为空场景,没有使用任何资源,过渡场景预加载C场景的资源
    3.切换到场景C,场景里也有一个按钮使用资源BtA
    4.切换过程异常

查看资源BtA:
var uuid = cc.loader._getResUuid(‘xxx/BtA’ , cc.SpriteFrame);
var id = cc.loader._getReferenceKey(uuid);
var item = cc.loader.getItem(id);
在场景A切B之前:
item.content {
_texture: cc_RenderTexture {_super: null, _name: “”, _objFlags: 0, _native: “”, _hasMipmap: false, …}
_textureFilename: “/Users/lgmacbook/Social/client/library/imports/82/8271caca-47de-4e82-bd31-97bab11daa5c.png”
addLoadedEventListener: (…)
_textureLoaded: (…)
_uuid: “b3642c96-ef93-4ba6-a069-b89bb453158a”
}

场景B切C之后:
_rotated: false
_texture: null
_textureFilename: “”
addLoadedEventListener: (…)
_textureLoaded: (…)
_uuid: “b3642c96-ef93-4ba6-a069-b89bb453158a”

分析:
应该是切过渡场景时,释放了Texture,但是未释放SprieFrame,但是这个BtA资源在过渡场景中未使用到

崩溃信息:
Simulator: ERROR: Uncaught TypeError: Cannot read property ‘__ONCE_FLAG:load’ of null, location: src/cocos2d-jsb.js:0:0
STACK:
[0]174.proto.hasEventListener@src/cocos2d-jsb.js:28718
[1]103.proto.once@src/cocos2d-jsb.js:20335
[2]onEnable@src/cocos2d-jsb.js:17390
[3]anonymous@src/cocos2d-jsb.js:26114
[4]invokeOnEnable@src/cocos2d-jsb.js:12095
[5]invoke@src/cocos2d-jsb.js:12015
[6]activateNode@src/cocos2d-jsb.js:23010
[7]_activate@src/cocos2d-jsb.js:9152
[8]runSceneImmediate@src/cocos2d-jsb.js:7074
[9]anonymous@src/cocos2d-jsb.js:7156
[10]anonymous@src/cocos2d-jsb.js:25609
[11]anonymous@src/cocos2d-jsb.js:20934
[12]anonymous@src/cocos2d-jsb.js:30249
[13]fireTimeout@jsb-adapter/jsb-builtin.js:2033
[14]tick@jsb-adapter/jsb-builtin.js:1995
[ERROR] (/Users/nantas/fireball-x/cocos2d-x-lite_20_release/cocos/scripting/js-bindings/jswrapper/v8/Object.cpp, 534): Invoking function (0x7fb42c7203d0) failed!
at HTMLElement.print-simulator-log (/Applications/CocosCreator.app/Contents/Resources/app.asar/editor/builtin/scene/panel/messages/scene.js:1:1501)
at Object.e._dispatch (/Applications/CocosCreator.app/Contents/Resources/app.asar/editor-framework/lib/renderer/panel.js:1:1941)
at EventEmitter.o.on.s (/Applications/CocosCreator.app/Contents/Resources/app.asar/editor-framework/lib/renderer/ipc.js:1:2917)
at emitMany (events.js:127:13)

  • 之前哪个版本是正常的 :

  • 手机型号 :

  • 手机浏览器 :

  • 编辑器操作系统 :

  • 编辑器之前是否有其它报错 :

  • 出现概率:必现

  • 额外线索:

我看下。

请给我你的测试demo。

怎么给你啊

非常抱歉,我又弄了个简单的DEMO来测试这个问题,发现是我自己弄错了。
原因是:切Scene B之前,我先创建了一个Loading界面,Loading界面里去preload Scene C(这步是多余的操作,忘记删除)
我又把这个Loading界面设置成了常驻节点,估计是这个导致了spriteFrame未被完全删除