TabBar: TabBar::MiddleDown fix (thanks cbpporter)

git-svn-id: svn://ultimatepp.org/upp/trunk@10753 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-01-25 10:22:37 +00:00
parent 0f0ef3d781
commit ee15b9989b

View file

@ -2133,21 +2133,23 @@ void TabBar::RightDown(Point p, dword keyflags)
void TabBar::MiddleDown(Point p, dword keyflags)
{
if (highlight >= 0)
{
Value v = tabs[highlight].key;
ValueArray vv;
vv.Add(v);
if (!CancelClose(v) && ! CancelCloseSome(vv)) {
Value v = tabs[highlight].key;
// 2014/03/06 - FIRST the callbacks, THEN remove the tab
// otherwise keys in WhenCloseSome() are invalid
WhenClose(v);
WhenCloseSome(vv);
TabClosed(v);
Close(highlight);
}
}
if (highlight >= 0)
{
Value v = tabs[highlight].key;
ValueArray vv;
vv.Add(v);
int highlightBack = highlight;
if (!CancelClose(v) && ! CancelCloseSome(vv)) {
// highlight can be changed by the prompt. When reading "v", it can be invalid. I use the value from before the prompt to fix it
Value v = tabs[highlightBack].key;
// 2014/03/06 - FIRST the callbacks, THEN remove the tab
// otherwise keys in WhenCloseSome() are invalid
WhenClose(v);
WhenCloseSome(vv);
TabClosed(v);
Close(highlightBack);
}
}
}
void TabBar::MiddleUp(Point p, dword keyflags)