-
Notifications
You must be signed in to change notification settings - Fork 336
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
Fix issue where first build of the VM Tools status bar would cause a null pointer exception #2905
Conversation
I'm not 100% sure this is the right approach here, but it does fix the issue. The other approach I tried involved statically initializing the controller in |
discussed offline - going to try a different approach that doesn't require adding the |
…null pointer exception `VMDeveloperToolsScreen` exposes a `ValueListenable` provided by the `VMDeveloperToolsController` in order to control the visibility of the isolate selector. Given that `VMDeveloperToolsScreen.showIsolateSelector` can be invoked before the static controller in `_VMDeveloperToolsScreenState` is initialized, a null pointer exception was being thrown when first building the VM Tools screen. This change updates `DevToolsScreen` to take either a `createController` callback or a pre-instantiated `controller`, allowing for the same instance of `VMDeveloperToolsController` to be used by `VMDeveloperToolsScreen` while also being exposed via `Provider`.
d44af36
to
d4507c4
Compare
Updated with new approach (and was able to drop the static controller in |
// Ensure that the current screen's state is initialized. In particular, | ||
// make sure that the screen's controller is available before calling | ||
// `currentScreen.showIsolateSelector`. |
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.
remove
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.
approved with a few comments
Red bots caused by #2916 |
Landing on red because flaky bots are frustrating. |
VMDeveloperToolsScreen
exposes aValueListenable
provided by theVMDeveloperToolsController
in order to control the visibility of the isolate selector. Given thatVMDeveloperToolsScreen.showIsolateSelector
can be invoked before the static controller in_VMDeveloperToolsScreenState
is initialized, a null pointer exception was being thrown when first building the VM Tools screen.This change updates
DevToolsScreen
to take either acreateController
callback or a pre-instantiatedcontroller
, allowing for the same instance ofVMDeveloperToolsController
to be used byVMDeveloperToolsScreen
while also being exposed viaProvider
.