зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1805799 - Make `TSFTextStore::Selection::Length` use `MOZ_ASSERT_IF` instead of `MOZ_ASSERT` to access `Maybe<TS_SELECTION_ACP>` r=m_kato
`ToString(mSelectionForTSF).c_str()` runs `TSFTextStore::Selection::operator<<` if it's some. Then, it calls `TSFTextStore::Selection::Length` always. https://searchfox.org/mozilla-central/rev/17aeb39742eba71e0936ae44a51a54197100166d/widget/windows/TSFTextStore.h#725 However, `TSFTextStore::Selection::mACP` can be nothing if there is no `Selection` ranges. Therefore, the `MOZ_ASSERT(mACP->acpEnd >= mACP->acpStart)` hits `Maybe<T>.isSome()` check in `->` operator. https://searchfox.org/mozilla-central/rev/17aeb39742eba71e0936ae44a51a54197100166d/widget/windows/TSFTextStore.h#681 Differential Revision: https://phabricator.services.mozilla.com/D164759
This commit is contained in:
Родитель
72b07d893e
Коммит
5546ae8990
|
@ -678,7 +678,7 @@ class TSFTextStore final : public ITextStoreACP,
|
|||
}
|
||||
|
||||
LONG Length() const {
|
||||
MOZ_ASSERT(mACP->acpEnd >= mACP->acpStart);
|
||||
MOZ_ASSERT_IF(mACP.isSome(), mACP->acpEnd >= mACP->acpStart);
|
||||
return mACP.isSome() ? std::abs(mACP->acpEnd - mACP->acpStart) : 0;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче