Hello guys! We’ve a <new issue >created about Clo...
# koin
p
Hello guys! We’ve a new issue created about ClosedScopeException. Basically, this piece of code
scope.close()
from
registerScopeForLifecycle
is running BEFORE activity
onDestroy
. So if developer is calling something injected in
onDestroy
, gets a crash. Any suggestions to handle this case? Because this start happen in our app when we bump version from
3.1.6
to
3.3.1
.
p
so I assume you are using
createActivityScope
when you say
Copy code
So if developer is calling something injected in onDestroy, gets a crash.
Can you give a sample ?
p
I’m using
ScopeActivity
. And yes, it’ll use
Copy code
fun ComponentActivity.activityScope() = lazy { createActivityScope() }
l
Maybe try to track with a boolean if the presenter is initialized? No need to load the presenter just to dispose it if it hasn’t been loaded yet.
p
I totally agree with you about to refactor. But the point is the crash is happening and was not expected to happen. Right now, I think my question was wrong. I’m not trying to fix the problem (it’s easy) but I want to know why the Koin code was changed the observer from
3.1.6
to
3.3.1
. It impacted a lot of activities to crash.
a
let me check if I can move things around 👍
tracked the issue for 3.4.0 milestone
p
Thanks, @arnaud.giuliani! blob smile happy