-
Notifications
You must be signed in to change notification settings - Fork 330
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
SmartRefreshLayout循环调用导致StackOverflowError堆栈溢出 #353
Comments
|
1 还在找 |
我已经 但是此问题我无法复现会导致比较麻烦 |
好的 感谢 |
如果你能发起pr修复就更好了,毕竟我无法复现此问题不太确定 |
我在尝试复现修复,目前有点眉目,等待下次发版后看反馈结果
在 2023-04-17 15:24:35,"劉強東" ***@***.***> 写道:
如果你能发起pr修复就更好了,毕竟我无法复现此问题不太确定
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
@Jove-zhou 问题有进展吗? |
还未解决
发件人: ***@***.*** ***@***.***> 代表 ���| ***@***.***>
日期: 星期六, 2023年5月27日 00:35
收件人: liangjingkanji/BRV ***@***.***>
抄送: Jove-zhou ***@***.***>, Mention ***@***.***>
主题: Re: [liangjingkanji/BRV] 集成的SmartRefreshLayout在完成刷新的判断中存在循环调用会导致堆栈溢出 (Issue #353)
@Jove-zhou<https://github.com/Jove-zhou> 问题有进展吗?
―
Reply to this email directly, view it on GitHub<#353 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA7GK5CAE5E5XW7IJGUOFZDXIDLU5ANCNFSM6AAAAAAWYQHBRU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
这个问题我遇到过,我的情况是这样的:
这个可能是库的问题,没有阻止两次 refresh 的刷新并且会陷入循环调用。但是我遇到的这个问题应该是可以人为避免的,你可以检查一下你的代码是否是我这种情况 |
并非你所说的这种情况 目前来看 非Refreshing的状态下完成一样会有此问题: |
无法复现此问题, 但是遇到过发生问题的人但没有去解决 } else if (mState == RefreshState.Loading && mRefreshFooter != null && mRefreshContent != null) {
count++;
mHandler.postDelayed(this, more);
//提前设置 状态为 LoadFinish 防止 postDelayed 导致 finishLoadMore 过后,外部判断 state 还是 Loading
notifyStateChanged(RefreshState.LoadFinish);
return;
} 但是没有进入这条件估计是 |
不仅如此 还会走到延迟为0的情况 已尝试多种方式 仍无法避免 Non-fatal Exception: java.lang.StackOverflowError: stack size 8188KB |
让我能复现此问题我就能修复 |
是否初始化? SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout -> MaterialHeader(this) }
SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout -> ClassicsFooter(this) } |
同样遇到这个问题了... @liangjingkanji 有眉目了嘛 |
这属于SmartRefreshLayout的bug, 我无法复现此问题所以无法修复 如果能让我复现此问题或者可以尝试反馈给SmartRefreshLayout作者 |
Duplicate of scwang90/SmartRefreshLayout#1470 可能是你们在Fragment的View还未创建时就开始调用加载 |
这问题我研究出来了,但这个问题是SmartRefreshLayout的问题,跟BRV没有关系 |
Activity的 val data = mutableListOf<Any>().apply {
for (i in 0..9) {
when (i) {
1, 2 -> add(FullSpanModel())
else -> add(SimpleModel())
}
}
}
binding.refresh.addData(data) { false } 因为没有更多数据了,会调用 @Override
public RefreshLayout setNoMoreData(boolean noMoreData) {
if (mState == RefreshState.Refreshing && noMoreData) {
// !!!!看这里 判断mState仍然处于Refreshing 且 noMoreData =true 至此进入递归循环调用
finishRefreshWithNoMoreData();
} else if (mState == RefreshState.Loading && noMoreData) {
finishLoadMoreWithNoMoreData();
} else if (mFooterNoMoreData != noMoreData) {
//不重要
}
return this;
} 为什么前面判断的 |
大佬分析的很仔细, 有没比较好的解决方案 @ChawLoo |
感谢 @ChawLoo 对此问题的复现和详细描述我通过拦截 private var currentNoMoreData: Boolean? = null
override fun setNoMoreData(noMoreData: Boolean): RefreshLayout {
if (mAttachedToWindow) {
super.setNoMoreData(noMoreData)
} else {
if (currentNoMoreData != noMoreData) {
currentNoMoreData = noMoreData
super.setNoMoreData(noMoreData)
}
}
return this
} 请升级至最新版本 |
在网络请求或异步任务快于Activity渲染就会导致此问题, 的确发生概率非常小 并且由于demo都在Fragment中的确无法复现此问题 |
已更新为最新版 从线上看 并不是 此原因造成的 Non-fatal Exception: java.lang.StackOverflowError: stack size 8188KB |
试下 implementation 'com.github.liangjingkanji:BRV:1.5.1' |
@Jove-zhou 该旧版本1.5.1一律禁止重复调用, 你试下这个版本 |
好的 |
到现在为止 没有再出现了 |
不知道为什么 |
你能再换成 |
1.5.2 之前用过 有问题 |
问题描述
SmartRefreshLayout现有版本存在某些特定情景导致刷新完成判断循环调用 此问题由来已久 没有完全解决
期望行为
能否集成一个轻量级刷新和自动加载三方库,或者仅提供自动加载回调
如何复现
截图
Non-fatal Exception: java.lang.StackOverflowError: stack size 8188KB
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$6.run(SmartRefreshLayout.java:2994)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefresh(SmartRefreshLayout.java:3043)
at com.drake.brv.PageRefreshLayout.finishRefresh(PageRefreshLayout.kt:457)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishRefreshWithNoMoreData(SmartRefreshLayout.java:3056)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.setNoMoreData(SmartRefreshLayout.java:2855)
at com.scwang.smart.refresh.layout.SmartRefreshLayout$7.run(SmartRefreshLayout.java:3134)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishLoadMore(SmartRefreshLayout.java:3226)
at com.drake.brv.PageRefreshLayout.finishLoadMore(PageRefreshLayout.kt:480)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.finishLoadMoreWithNoMoreData(SmartRefreshLayout.java:3239)
at com.dhgate.buyermob.ui.order.DHOrderCenterRepeatFragment.initObserve$lambda-9$lambda-8(DHOrderCenterRepeatFragment.kt:274)
at com.dhgate.buyermob.ui.order.DHOrderCenterRepeatFragment.$r8$lambda$nnS4UzGBLgrr3FPso16Izi2xGG0()
at com.dhgate.buyermob.ui.order.DHOrderCenterRepeatFragment$$ExternalSyntheticLambda4.onChanged(:4)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151)
at androidx.lifecycle.LiveData.setValue(LiveData.java:309)
at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
at androidx.lifecycle.LiveData$1.run(LiveData.java:93)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
版本
The text was updated successfully, but these errors were encountered: