Handle Quick tab behavior when undocked in FlightData view#3683
Open
ArthurPatriot wants to merge 1 commit intoArduPilot:masterfrom
Open
Handle Quick tab behavior when undocked in FlightData view#3683ArthurPatriot wants to merge 1 commit intoArduPilot:masterfrom
ArthurPatriot wants to merge 1 commit intoArduPilot:masterfrom
Conversation
Contributor
Author
There was a problem hiding this comment.
Pull request overview
Fixes the “ghost Quick tab” issue in FlightData when the Quick tab is undocked into a popup, by preventing updateDisplayView()/loadTabControlActions() from reparenting the detached tabQuick back into the main tabControlactions.
Changes:
- Skip restoring
tabQuickintotabControlactionswhile it is detached (tabQuickDetached == true). - Prevent the “ensure at least one tab” fallback from forcibly re-adding
tabQuickwhile detached.
Comments suppressed due to low confidence (2)
GCSViews/FlightData.cs:776
- When
tabQuickDetachedis true, this guard can leavetabControlactionswith zero TabPages (e.g., if the user's display configuration hides all other tabs). That state can trigger runtime exceptions elsewhere (for example,ProcessCmdKeyassignstabControlactions.SelectedIndex = 0..9without checking bounds). Consider keeping the "at least one tab" invariant by selecting/adding the first available non-Quick tab when detached, or by otherwise ensuringTabPages.Count > 0even in the detached state (without reparentingtabQuick).
//we want to at least have one tabpage
if (tabControlactions.TabPages.Count == 0 && !tabQuickDetached)
{
tabControlactions.TabPages.Add(tabQuick);
tabControlactions.SelectedIndex = 0;
}
GCSViews/FlightData.cs:761
- With
tabQuickDetachedtrue, tabs that includetabQuickin the saved order will now hit the!addedbranch and log "not added to tabControlactions tabQuick" even though it was intentionally skipped. This can create misleading/debug-noisy logs wheneverloadTabControlActions()runs while detached. Consider treating the Quick tab as "handled" in this case (e.g., setadded = truefor that tabname or adjust the log message to explicitly say it was skipped due to detachment).
bool added = false;
foreach (TabPage tabPage in TabListOriginal)
{
// skip the Quick tab if it is currently undocked into a popup window
if (tabQuickDetached && tabPage == tabQuick)
continue;
if (tabPage.Name == tabname && ((TabListDisplay.ContainsKey(tabname) && TabListDisplay[tabname] == true) || !TabListDisplay.ContainsKey(tabname)))
{
tabControlactions.TabPages.Add(tabPage);
log.Debug("add tabControlactions " + tabPage.Name);
added = true;
break;
}
}
if(!added)
log.Debug("not added to tabControlactions " + tabname);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ea7d711 to
a91d0dd
Compare
Contributor
Author
|
@meee1 can be merged |
Collaborator
|
I'm currently travelling. I won't be merging till after I can verify |
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.
Fix for #3673
When the Quick tab is undocked into a popup window, navigating away from the Flight Data screen (clicking PLAN, SETUP, CONFIG, etc.) and then returning triggers FlightData.Activate(), which calls updateDisplayView() → loadTabControlActions(). That method calls tabControlactions.TabPages.Clear() and then re-adds all tabs from the original list — including tabQuick, which is currently living in the popup form. The TabPages.Add(tabQuick) call reparents tabQuick back to tabControlactions, stealing it from the popup window and leaving it empty (the "ghost" window).
Fix (2 changes in FlightData.cs)