From 1ac4b75dccd8698f1b0357dd4c0b75fbcf31d711 Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Sat, 6 Nov 1999 00:54:54 +0000 Subject: [PATCH] Bug 17995: Don't reset selection when adding an option to a combobox, as it caused reframing and a crash. r=harishd a=choffman --- layout/forms/nsComboboxControlFrame.cpp | 5 ++++- layout/html/forms/src/nsComboboxControlFrame.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index c3d80816b7fd..0c02b94fca94 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -1091,7 +1091,10 @@ nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) NS_RELEASE(listFrame); } // If we added the first option, we might need to select it. - MakeSureSomethingIsSelected(aPresContext); + // We should call MakeSureSomethingIsSelected here, but since it + // it changes selection, which currently causes a reframe, and thus + // deletes the frame out from under the caller, causing a crash. (Bug 17995) + // XXX BAD MakeSureSomethingIsSelected(aPresContext); return rv; } diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index c3d80816b7fd..0c02b94fca94 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -1091,7 +1091,10 @@ nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) NS_RELEASE(listFrame); } // If we added the first option, we might need to select it. - MakeSureSomethingIsSelected(aPresContext); + // We should call MakeSureSomethingIsSelected here, but since it + // it changes selection, which currently causes a reframe, and thus + // deletes the frame out from under the caller, causing a crash. (Bug 17995) + // XXX BAD MakeSureSomethingIsSelected(aPresContext); return rv; }