From e721d4ecd34778ce28123f3ba38056009dd4f544 Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Tue, 21 Sep 1999 13:25:32 +0000 Subject: [PATCH] Bug 11488: Crash when deleting options from GFX selects git-svn-id: svn://10.0.0.236/trunk@48569 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsListControlFrame.cpp | 6 +++--- mozilla/layout/html/forms/src/nsListControlFrame.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 7a32ab5a2ab..4e06a3a0b6f 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -1607,10 +1607,10 @@ nsListControlFrame::RemoveOption(PRInt32 aIndex) GetSelectedIndexFromDOM(&selectedIndex); // comes from the DOM if (aIndex == mSelectedIndex) { - ToggleSelected(selectedIndex); // sets mSelectedIndex - } else { - mSelectedIndex = selectedIndex; + // Don't need to deselect option as it is being removed anyway. + SetContentSelected(selectedIndex, PR_TRUE); // Select the new selectedIndex } + mSelectedIndex = selectedIndex; if (nsnull != mComboboxFrame) { mComboboxFrame->UpdateSelection(PR_FALSE, PR_TRUE, selectedIndex); // don't dispatch event } diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 7a32ab5a2ab..4e06a3a0b6f 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -1607,10 +1607,10 @@ nsListControlFrame::RemoveOption(PRInt32 aIndex) GetSelectedIndexFromDOM(&selectedIndex); // comes from the DOM if (aIndex == mSelectedIndex) { - ToggleSelected(selectedIndex); // sets mSelectedIndex - } else { - mSelectedIndex = selectedIndex; + // Don't need to deselect option as it is being removed anyway. + SetContentSelected(selectedIndex, PR_TRUE); // Select the new selectedIndex } + mSelectedIndex = selectedIndex; if (nsnull != mComboboxFrame) { mComboboxFrame->UpdateSelection(PR_FALSE, PR_TRUE, selectedIndex); // don't dispatch event }