BMenu: Check return value of LockLooper().

CIDs 602450-602452.
This commit is contained in:
Augustin Cavalier 2015-08-04 09:02:52 -04:00
parent b0ed323924
commit fb4ea396e3

View File

@ -1833,10 +1833,12 @@ BMenu::_UpdateNavigationArea(BPoint position, BRect& navAreaRectAbove,
if (submenu != NULL) { if (submenu != NULL) {
BRect menuBounds = ConvertToScreen(Bounds()); BRect menuBounds = ConvertToScreen(Bounds());
fSelected->Submenu()->LockLooper(); BRect submenuBounds;
BRect submenuBounds = fSelected->Submenu()->ConvertToScreen( if (fSelected->Submenu()->LockLooper()) {
fSelected->Submenu()->Bounds()); submenuBounds = fSelected->Submenu()->ConvertToScreen(
fSelected->Submenu()->UnlockLooper(); fSelected->Submenu()->Bounds());
fSelected->Submenu()->UnlockLooper();
}
if (menuBounds.left < submenuBounds.left) { if (menuBounds.left < submenuBounds.left) {
navAreaRectAbove.Set(position.x + NAV_AREA_THRESHOLD, navAreaRectAbove.Set(position.x + NAV_AREA_THRESHOLD,
@ -1889,10 +1891,12 @@ BMenu::_UpdateStateOpenSelect(BMenuItem* item, BPoint position,
BRect menuBounds = ConvertToScreen(Bounds()); BRect menuBounds = ConvertToScreen(Bounds());
fSelected->Submenu()->LockLooper(); BRect submenuBounds;
BRect submenuBounds = fSelected->Submenu()->ConvertToScreen( if (fSelected->Submenu()->LockLooper()) {
fSelected->Submenu()->Bounds()); fSelected->Submenu()->ConvertToScreen(
fSelected->Submenu()->UnlockLooper(); fSelected->Submenu()->Bounds());
fSelected->Submenu()->UnlockLooper();
}
float xOffset; float xOffset;
@ -1963,8 +1967,7 @@ BMenu::_UpdateStateClose(BMenuItem* item, const BPoint& where,
if (buttons != 0 && _IsStickyMode()) { if (buttons != 0 && _IsStickyMode()) {
if (item == NULL) { if (item == NULL) {
if (item != fSelected) { if (item != fSelected && LockLooper()) {
LockLooper();
_SelectItem(item, false); _SelectItem(item, false);
UnlockLooper(); UnlockLooper();
} }
@ -1978,8 +1981,7 @@ BMenu::_UpdateStateClose(BMenuItem* item, const BPoint& where,
// Setting this to NULL will prevent this code // Setting this to NULL will prevent this code
// to be executed next time // to be executed next time
} else { } else {
if (item != fSelected) { if (item != fSelected && LockLooper()) {
LockLooper();
_SelectItem(item, false); _SelectItem(item, false);
UnlockLooper(); UnlockLooper();
} }