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

SupportActivity#popTo方法中afterPopTransactionRunnable在popTo之前就执行了 #778

Closed
palatine opened this issue Feb 11, 2018 · 3 comments · Fixed by #782
Closed
Labels

Comments

@palatine
Copy link

palatine commented Feb 11, 2018

大神你好, 请问下我升级到v1.2.6之后发现以前的页面pop异常, 查看源码发现popTo的实现有所改变,

void popTo(final String targetFragmentTag, final boolean includeTargetFragment, final Runnable afterPopTransactionRunnable, final FragmentManager fm, final int popAnim) {
        enqueue(fm, new Action(Action.ACTION_POP_MOCK) {
            @Override
            public void run() {
                doPopTo(targetFragmentTag, includeTargetFragment, afterPopTransactionRunnable, fm, popAnim);
            }
        });
        if (afterPopTransactionRunnable != null) {
            afterPopTransactionRunnable.run();  <-- 已经被执行了
        }
    }

当前请求被enqueue之后, afterPopTransactionRunnable就立即被执行了? 我理解应该是执行完popTo真正完成之后才会执行afterPopTransactionRunnable吧?

@YoKeyword YoKeyword added the bug label Feb 11, 2018
@YoKeyword
Copy link
Owner

YoKeyword commented Feb 11, 2018

@palatine 感谢指出,确实不是很合理,之前这么处理,是因为只考虑到在Runnable中执行的也是事务,那么自然也会入队,但是确实未必全是事务

严谨的话确实应该在popTo()完成后才执行afterPopTransactionRunnable,下一版本修复

@palatine
Copy link
Author

感谢答复, 辛苦了:-)

@YoKeyword
Copy link
Owner

已修复v1.2.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants