From a14448f3f4b1619d1610cc474f5cdae2014aafbd Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 25 Aug 2013 08:38:29 +0000 Subject: [PATCH] TabBar: fixed crashing issue (thanks Klugier) git-svn-id: svn://ultimatepp.org/upp/trunk@6262 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/TabBar/TabBar.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/uppsrc/TabBar/TabBar.cpp b/uppsrc/TabBar/TabBar.cpp index ef72b1582..2d247ef8c 100644 --- a/uppsrc/TabBar/TabBar.cpp +++ b/uppsrc/TabBar/TabBar.cpp @@ -1922,14 +1922,19 @@ void TabBar::LeftDown(Point p, dword keyflags) return; if(cross != -1) { - Value v = tabs[cross].key; - Vectorvv; - vv.Add(v); - int ix = cross; - if (!CancelClose(v) && !CancelCloseSome(Vector(vv, 0))) { - Close(ix); - WhenClose(v); - WhenCloseSome(vv); + if (cross < tabs.GetCount()) { + int tempCross = cross; + Value v = tabs[cross].key; + Vectorvv; + vv.Add(v); + int ix = cross; + if (!CancelClose(v) && !CancelCloseSome(Vector(vv, 0))) { + Close(ix); + WhenClose(v); + WhenCloseSome(vv); + } + if (tempCross >= 0 && tempCross < tabs.GetCount()) + ProcessMouse(tempCross, p); } } else if(highlight >= 0) {