Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
436 views
in Technique[技术] by (71.8m points)

java - GWTP: onUnbind() never called after closing a presenter

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));
    }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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,


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...