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

'○○Controller'という名前のプロパティにコントローラインスタンスでないものを持つコントローラをdisposeしようとするとエラーになる場合がある #284

Closed
fukudayasuo opened this issue Mar 19, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@fukudayasuo
Copy link

'Controller'で終わるプロパティにコントローラインスタンスでないもの、またはdisposeされたコントローラインスタンスが格納されているようなコントローラをdisposeするとエラーが発生する。

// コントローラインスタンスでないものが格納されている例
h5.core.controller(document.body, {
    __name: 'A'
}).readyPromise.done(function() {
    this.xxxController = {};
    this.dispose(); // TypeError: Cannot read property 'isRoot' of undefined
});

// コントローラインスタンスを格納していたがdisposeされてしまった例
h5.core.controller(document.body, {
    __name: 'A',
    __ready: function() {
        this.xxxController = h5.core.controller(this.rootElement, {
            __name: 'B'
        });
    }
}).readyPromise.done(function() {
    var that = this;
    this.xxxController.dispose().done(function() {
        that.dispose(); // TypeError: Cannot read property 'isRoot' of undefined
    });
});
@simdy simdy added the bug label Mar 19, 2014
@simdy simdy added this to the v1.1.10 milestone Mar 19, 2014
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Mar 19, 2014
コントローラインスタンスかどうか(__controllerContextの有無)を判定するようにしました。
また自分自身を指していないこと(target!==controller)のチェックもするようにしました。
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Mar 19, 2014
disposeControllerで、子コントローラのdispose処理が終わってからプロパティにnull代入を行うようにしました。
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Mar 19, 2014
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Mar 19, 2014
xxxControllerに子コントローラ以外のコントローラを持たせてdisposeが正しくできる事を確認するテストを追加しました。
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Mar 20, 2014
if文の不要なネストを無くしました。
fukudayasuo pushed a commit to hifive-labs/hifivemain that referenced this issue Mar 20, 2014
@simdy simdy closed this as completed May 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants