Skip to content

Commit 0b6d95f

Browse files
committed
fix(plugin-manager): stop crash restoring plugin fragments after process death
When a plugin dialog fragment (e.g. the AI settings dialog) is restored from saved state after process death — before the plugin has reloaded and registered its classloader — the factory's fallback was meant to substitute a placeholder Fragment. It caught ClassNotFoundException, but FragmentFactory.loadFragmentClass wraps that in a Fragment.InstantiationException, so the catch never matched and the exception propagated into a fatal crash loop. Also catch Fragment.InstantiationException so the placeholder substitution actually runs.
1 parent 2bf361c commit 0b6d95f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎plugin-manager/src/main/kotlin/com/itsaky/androidide/plugins/manager/fragment/PluginFragmentFactory.kt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ class PluginFragmentFactory(
8484
Log.d(TAG, "Using default factory for fragment: $className")
8585
return try {
8686
defaultFactory.instantiate(classLoader, className)
87+
} catch (e: Fragment.InstantiationException) {
88+
Log.w(TAG, "No classloader available for '$className'; substituting placeholder", e)
89+
Fragment()
8790
} catch (e: ClassNotFoundException) {
8891
Log.w(TAG, "No classloader available for '$className'; substituting placeholder", e)
8992
Fragment()

0 commit comments

Comments
 (0)