-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Android: Call UICommon::Init at app start instead of emulation start #8190
Conversation
} | ||
}); | ||
// Registers the DirectoryStateReceiver and its intent filters | ||
LocalBroadcastManager.getInstance(context).registerReceiver( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a 1:1 thing? It feels like it would just be a list of receivers, each notified in turn when something happens.
If it is indeed a list, I'd expect any older invocations to still be alive; rendering the last paragraph of the comment above slightly fuzzy.
Unless we want it to be like that; then we're probably supposed to call unregisterReceiver
in case directoryStateReceiver
is not null
.
...not that it matters too much, since you keep creating new instances in the places where it is used; so they'd likely end up running anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was assuming that the old directoryStateReceiver
would get deallocated once we create a new directoryStateReceiver
, but I suppose that might not be true since the LocalBroadcastManager
keeps a reference to it... Since I'm not entirely sure how it works, I think I'll just change the comment to say that multiple calls is not a supported use case, because that's how I've been thinking of it while writing the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'll just delete the part of the comment that mentions multiple calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but if it works anything close to C# wrt the GC, it should still be referenced by the LocalBroadcastManager
(and the closure itself should still be referencing the passed runnable
, keeping it alive as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard my previous comment – I've realized that multiple calls should not be encouraged, because if old DirectoryStateReceiver
s indeed are kept around (which is likely), the way we do unregistration means that newer calls will get dropped rather than old calls. I will make the comment say that multiple calls is not a supported use case.
b1726ba
to
d4a21b8
Compare
rebase pls |
Much of our native code assumes that UICommon::Init has been called (for reasons such as wanting to access the user's settings), so not calling it until emulation start heavily limits what native code we can use in the Android GUI (except during emulation).
Preparation for the next commit.
Much of our native code assumes that
UICommon::Init
has been called (for reasons such as wanting to access the user's settings), so not calling it until emulation start heavily limits what native code we can use in the Android GUI (except during emulation).This should not be merged before https://bugs.dolphin-emu.org/issues/11767 has been addressed, because the third commit of this PR makes that race condition worse if my thinking is correct.