Skip to content

Commit e92c03b

Browse files
authored
Merge pull request #252 from winnerspiros/copilot/fix-osu-crash-dependency
Fix Android startup crash: don't take `OsuConfigManager` as a BDL parameter on `OsuGameAndroid`
2 parents 476c398 + 2642851 commit e92c03b

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

osu.Android/OsuGameAndroid.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,18 @@ public override Version AssemblyVersion
152152
/// to drive <see cref="applyAndroidFrameSyncMigrationOnce"/>, the one-shot Android
153153
/// FrameSync default migration; everything else here is unrelated init wiring.
154154
/// </summary>
155+
/// <remarks>
156+
/// We must NOT take <see cref="OsuConfigManager"/> as a BDL parameter here. The
157+
/// dependency activator resolves BDL parameters from the parent dependency
158+
/// container, but <see cref="OsuGameBase.load"/> caches <c>LocalConfig</c> into
159+
/// the child container (the one returned from <c>CreateChildDependencies</c>).
160+
/// Resolving <c>OsuConfigManager</c> as a parameter therefore throws
161+
/// <c>DependencyNotRegisteredException</c> before this method body even runs.
162+
/// Use the inherited <see cref="OsuGameBase.LocalConfig"/> field instead — it is
163+
/// guaranteed to be non-null because <c>SetHost</c> creates it before any BDL.
164+
/// </remarks>
155165
[BackgroundDependencyLoader]
156-
private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager osuConfig)
166+
private void load(FrameworkConfigManager frameworkConfig)
157167
{
158168
LocalConfig.BindWith(OsuSetting.AndroidPerformanceMode, performanceMode);
159169
LocalConfig.BindWith(OsuSetting.AndroidLowLatencyAudio, lowLatencyAudio);
@@ -171,9 +181,9 @@ private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager osuCo
171181
// AndroidStartupFlags in the activity.
172182
try
173183
{
174-
osuConfig.BindWith(OsuSetting.AndroidCleanupStaleRealmFifos, cleanupStaleRealmFifos);
175-
osuConfig.BindWith(OsuSetting.AndroidDeferStartupNativeInit, deferStartupNativeInit);
176-
osuConfig.BindWith(OsuSetting.AndroidStartupFrameSyncMigrationEnabled, startupFrameSyncMigrationEnabled);
184+
LocalConfig.BindWith(OsuSetting.AndroidCleanupStaleRealmFifos, cleanupStaleRealmFifos);
185+
LocalConfig.BindWith(OsuSetting.AndroidDeferStartupNativeInit, deferStartupNativeInit);
186+
LocalConfig.BindWith(OsuSetting.AndroidStartupFrameSyncMigrationEnabled, startupFrameSyncMigrationEnabled);
177187

178188
// sentinelOnDisable=true → presence ⇒ "feature disabled". The
179189
// safety nets default to ON, so the sentinel is created only

0 commit comments

Comments
 (0)