ui: remove interactive timeout callback when driver camera dialog closes#38237
Open
srijavuppala wants to merge 1 commit into
Open
ui: remove interactive timeout callback when driver camera dialog closes#38237srijavuppala wants to merge 1 commit into
srijavuppala wants to merge 1 commit into
Conversation
Device.add_interactive_timeout_callback() had no corresponding remove method, so every time the driver camera dialog was opened a new gui_app.pop_widget callback was appended and never cleaned up. Opening the dialog repeatedly grew the callback list unbounded. Add Device.remove_interactive_timeout_callback() and call it from hide_event() on both the tici and mici DriverCameraDialog so the callback is removed when the dialog closes.
Contributor
Process replay diff reportReplays driving segments through this PR and compares the behavior to master. ✅ 0 changed, 66 passed, 0 errors |
Contributor
UI Previewmici: Videos are identical! View Diff Report |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #37536.
Device.add_interactive_timeout_callback()only appends to a list; there was no way to remove a callback once added. The driver camera dialog (DriverCameraDialog, both tici and mici variants) is constructed fresh every time it's opened from settings, and each construction registered a newgui_app.pop_widgetcallback that was never removed. Opening the dialog repeatedly grows_interactive_timeout_callbacksunbounded, as flagged by the existing# TODO: this can grow unboundedcomment.Device.remove_interactive_timeout_callback()inselfdrive/ui/ui_state.pyhide_event()in bothselfdrive/ui/onroad/driver_camera_dialog.pyandselfdrive/ui/mici/onroad/driver_camera_dialog.py, removing the leftover TODO comments now that it's handledThe other three call sites listed in the issue (
MainLayout,MiciMainLayout,TrainingGuideDMTutorial) register their callback once for the lifetime of the process and aren't constructed repeatedly, so they don't leak and weren't changed.Test plan
ruff checkpasses on all three changed filesDevice.remove_interactive_timeout_callback()removes exactly one matching entry from the list (mirrorslist.remove()semantics, symmetric withadd_interactive_timeout_callback'slist.append())DriverCameraDialoglifecycles to confirmhide_event()is the right place to remove the callback (mirrors howIsDriverViewEnabledandset_override_interactive_timeoutare already reset there)