[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/applets/tasks
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2009-05-12 9:10:04
Message-ID: 1242119404.189933.18461.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 966907 by aseigo:
make sure that the items we hover have tasks before we access them; also reduce the \
default allocation of the QVarLengthArray down to 32 items since it'll be rare to \
have more than that number of windows in a group (and 1024 is just silly :) \
BUG:192411
M +28 -5 abstracttaskitem.cpp
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/abstracttaskitem.cpp \
#966906:966907 @@ -385,21 +385,44 @@
if (item->isGroupItem()) {
//TODO: recurse through sub-groups?
} else {
- windows.append(static_cast<TaskManager::TaskItem*>(item));
+ TaskManager::TaskItem *taskItem = \
static_cast<TaskManager::TaskItem*>(item); + if (taskItem->task()) \
{ + windows.append(taskItem);
+ }
}
}
} else {
- windows.append(static_cast<TaskManager::TaskItem*>(m_abstractItem));
+ TaskManager::TaskItem *taskItem = \
static_cast<TaskManager::TaskItem*>(m_abstractItem); + if \
(taskItem->task()) { + windows.append(taskItem);
+ }
}
const int numWindows = windows.count();
- QVarLengthArray<long, 1024> data(numWindows);
+ QVarLengthArray<long, 32> data(numWindows);
- kDebug() << "setting for" << numWindows;
+ //kDebug() << "setting for" << numWindows;
+ int actualCount = 0;
for (int i = 0; i < numWindows; ++i) {
- data[i] = windows.at(i)->task()->window();
+ TaskManager::TaskItem *item = windows.at(i);
+
+ // we've already checked that the item has a task in the foreach above
+ // but this bit of paranoia should lock the deal; the checks in the \
foreach + // above will help prevent call to data.resize below from \
happening, + // but this should catch any odd events that might happen; \
afaict this is + // currently impossible, but it's too easy to introduce \
such situations in the + // future with modifications to the code above \
this and it's easy to do + // the check here. better safe than sorry, \
right? :) - aseigo + if (item->task()) {
+ data[i] = item->task()->window();
+ ++actualCount;
+ }
}
+ if (actualCount != numWindows) {
+ data.resize(actualCount);
+ }
+
Display *dpy = QX11Info::display();
if (m_applet->view()) {
const WId winId = m_applet->view()->winId();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic