GWTP: onUnbind() never called after closing a presenter

只谈情不闲聊 提交于 2019-12-25 03:29:32

问题


I have a GWTP MyPresenter that registers a handler at onBind(), and it works perfectly. The problem is when I leave the presenter using the BACK arrow on the browser. The onUnbind() is never called (I tried with an breakpoint overriding the method, but is never executed). So that this handler is never unregistered. What is wrong? Thanks.

public class MyPresenter extends
    PresenterWidget<ViewDiagramPresenter.MyView> {
    [...]

    @Override
    protected void onBind() {
        super.onBind();
        registerHandler(getEventBus().addHandler(myEvent.getType(), myHandler));
    }
}

回答1:


As I recall onUnBind() is not called when the Presenter is hidden, that would trigger the onHide() method. Specifically, I think the onUnBind() should be called manually - you could eg. chain it if you override onHide().

Hope that helps.

Cheers,



来源:https://stackoverflow.com/questions/13396992/gwtp-onunbind-never-called-after-closing-a-presenter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!