hrev54159 adds 1 changeset to branch 'master'
old head: 24337d5342a11685ca61ac80e72391dd95bd7a7f
new head: 2edfb7b1454d49bc91a722fa23b739ea36f4c9d2
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=2edfb7b1454d+%5E24337d5342a1
----------------------------------------------------------------------------
2edfb7b1454d: DeskBar: misplaced NULL check
- Main problem was that lastItem was accidentally used outside of a NULL check
- Also cleanup initialization and reset of fLastClickedItem (it is now valid
from mousedown on an item to either mouseup, or when the team dies)
Fixes #15991
Change-Id: I82e30303c50a61b9d44c092347f067dcb1105006
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2619
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54159
Commit: 2edfb7b1454d49bc91a722fa23b739ea36f4c9d2
URL: https://git.haiku-os.org/haiku/commit/?id=2edfb7b1454d
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Sat May 9 08:25:05 2020 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Sat May 9 13:22:30 2020 UTC
Ticket: https://dev.haiku-os.org/ticket/15991
----------------------------------------------------------------------------
1 file changed, 6 insertions(+), 5 deletions(-)
src/apps/deskbar/ExpandoMenuBar.cpp | 11 ++++++-----
----------------------------------------------------------------------------
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp
b/src/apps/deskbar/ExpandoMenuBar.cpp
index d92e91c917..ad21595158 100644
--- a/src/apps/deskbar/ExpandoMenuBar.cpp
+++ b/src/apps/deskbar/ExpandoMenuBar.cpp
@@ -256,6 +256,7 @@ TExpandoMenuBar::MouseDown(BPoint where)
BMessage* message = Window()->CurrentMessage();
BMenuItem* menuItem;
TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem);
+ fLastClickedItem = item;
if (message == NULL || item == NULL || fBarView == NULL
|| fBarView->Dragging()) {
@@ -323,7 +324,6 @@ TExpandoMenuBar::MouseDown(BPoint where)
if (Vertical() &&
static_cast<TBarApp*>(be_app)->Settings()->superExpando
&& item->ExpanderBounds().Contains(where)) {
// start the animation here, finish on mouse up
- fLastClickedItem = item;
item->SetArrowDirection(BControlLook::B_RIGHT_DOWN_ARROW);
SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
Invalidate(item->ExpanderBounds());
@@ -341,7 +341,6 @@ TExpandoMenuBar::MouseDown(BPoint where)
// absorb the message
}
- fLastClickedItem = item;
BMenuBar::MouseDown(where);
}
@@ -372,9 +371,9 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code,
const BMessage* message)
? BControlLook::B_DOWN_ARROW
: BControlLook::B_RIGHT_ARROW);
}
- }
- Invalidate(lastItem->ExpanderBounds());
+ Invalidate(lastItem->ExpanderBounds());
+ }
}
switch (code) {
@@ -482,13 +481,15 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code,
const BMessage* message)
void
TExpandoMenuBar::MouseUp(BPoint where)
{
+ TTeamMenuItem* lastItem =
dynamic_cast<TTeamMenuItem*>(fLastClickedItem);
+ fLastClickedItem = NULL;
+
if (fBarView != NULL && fBarView->Dragging()) {
_FinishedDrag(true);
return;
// absorb the message
}
- TTeamMenuItem* lastItem =
dynamic_cast<TTeamMenuItem*>(fLastClickedItem);
if (lastItem != NULL && lastItem->ExpanderBounds().Contains(where)) {
lastItem->ToggleExpandState(true);
lastItem->SetArrowDirection(lastItem->IsExpanded()