Bug 825786 - crash in nsAutoCompleteController::HandleDelete.

r=Enn
This commit is contained in:
Marco Bonardo 2013-01-17 00:12:43 +01:00
Родитель 078c32133c
Коммит f572427091
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -574,7 +574,7 @@ nsAutoCompleteController::HandleDelete(bool *_retval)
// Complete to the new current value.
bool shouldComplete = false;
mInput->GetCompleteDefaultIndex(&shouldComplete);
input->GetCompleteDefaultIndex(&shouldComplete);
if (shouldComplete) {
nsAutoString value;
if (NS_SUCCEEDED(GetResultValueAt(index, true, value))) {
@ -1171,7 +1171,7 @@ nsAutoCompleteController::EnterMatch(bool aIsPopupSelection)
popup->GetOverrideValue(value);
if (value.IsEmpty()) {
bool shouldComplete;
mInput->GetCompleteDefaultIndex(&shouldComplete);
input->GetCompleteDefaultIndex(&shouldComplete);
bool completeSelection;
input->GetCompleteSelectedIndex(&completeSelection);
@ -1376,7 +1376,7 @@ nsAutoCompleteController::PostSearchCleanup()
nsCOMPtr<nsIAutoCompleteInput> input(mInput);
uint32_t minResults;
mInput->GetMinResultsForPopup(&minResults);
input->GetMinResultsForPopup(&minResults);
if (mRowCount || minResults == 0) {
OpenPopup();
@ -1535,6 +1535,7 @@ nsAutoCompleteController::GetDefaultCompleteValue(int32_t aResultIndex,
nsresult
nsAutoCompleteController::GetFinalDefaultCompleteValue(nsAString &_retval)
{
MOZ_ASSERT(mInput, "Must have a valid input");
nsIAutoCompleteResult *result;
int32_t defaultIndex = -1;
nsresult rv = GetDefaultCompleteResult(-1, &result, &defaultIndex);
@ -1572,6 +1573,7 @@ nsAutoCompleteController::CompleteValue(nsString &aValue)
* selectDifference is true, select the remaining portion of aValue not
* contained in mSearchString. */
{
MOZ_ASSERT(mInput, "Must have a valid input");
const int32_t mSearchStringLength = mSearchString.Length();
int32_t endSelect = aValue.Length(); // By default, select all of aValue.