Bug 1363887: Use nsAutoHandle for CreateBitmap call in AccessibleWrap::UpdateSystemCaretFor; r=tbsaunde

MozReview-Commit-ID: CbLqtqMEw32

--HG--
extra : rebase_source : 44a96fef761917b09f96f5a46be94327df504e67
This commit is contained in:
Aaron Klotz 2017-05-10 16:04:05 -06:00
Родитель 4d0d5937ec
Коммит 0c505ba983
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -15,6 +15,7 @@
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsIAccessibleEvent.h"
#include "nsWindowsHelpers.h"
#include "nsWinUtils.h"
#include "mozilla/a11y/ProxyAccessible.h"
#include "ProxyWrappers.h"
@ -1565,13 +1566,12 @@ AccessibleWrap::UpdateSystemCaretFor(Accessible* aAccessible)
// Create invisible bitmap for caret, otherwise its appearance interferes
// with Gecko caret
HBITMAP caretBitMap = CreateBitmap(1, caretRect.height, 1, 1, nullptr);
nsAutoBitmap caretBitMap(CreateBitmap(1, caretRect.height, 1, 1, nullptr));
if (::CreateCaret(caretWnd, caretBitMap, 1, caretRect.height)) { // Also destroys the last caret
::ShowCaret(caretWnd);
RECT windowRect;
::GetWindowRect(caretWnd, &windowRect);
::SetCaretPos(caretRect.x - windowRect.left, caretRect.y - windowRect.top);
::DeleteObject(caretBitMap);
}
}