[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Mon Aug 30 21:24:33 CEST 2004
CVS commit by arwalker:
This occurs as the data manager may be requested to updateContents( ... ) before update( ... ). If this happens then a crash may result if any object's name in the data manager had been changed in the meantime. If the object name (part of the KstObjectItem) can not be found then the code assert's (and so crashes).
The solution is not to assert, but instead check that the object corresponding to the name was found.
CCMAIL: 88357-done at bugs.kde.org
M +65 -62 kstdatamanager_i.cpp 1.81
--- kdeextragear-2/kst/kst/kstdatamanager_i.cpp #1.80:1.81
@@ -93,7 +93,7 @@ void KstObjectItem::update(bool recursiv
{
KstVectorPtr px = *KST::vectorList.findTag(_name);
- assert(px.data());
- assert(dynamic_cast<KstRVector*>(px.data()));
+ if (px) {
KstRVectorPtr x = static_cast<KstRVector*>(px.data());
+ if (x) {
x->readLock();
//
@@ -110,4 +110,6 @@ void KstObjectItem::update(bool recursiv
_removable = x->getUsage() == 2;
x->readUnlock();
+ }
+ }
break;
}
@@ -115,5 +117,5 @@ void KstObjectItem::update(bool recursiv
{
KstVectorPtr x = *KST::vectorList.findTag(_name);
- assert(x.data());
+ if (x) {
x->readLock();
//
@@ -126,4 +128,5 @@ void KstObjectItem::update(bool recursiv
x->readUnlock();
_removable = false;
+ }
break;
}
@@ -131,5 +134,5 @@ void KstObjectItem::update(bool recursiv
{
KstDataObjectPtr x = *KST::dataObjectList.findTag(_name);
- assert(x.data());
+ if (x) {
x->readLock();
//
@@ -154,6 +157,5 @@ void KstObjectItem::update(bool recursiv
for (KstVectorMap::Iterator p = x->outputVectors().begin();
- p != x->outputVectors().end();
- ++p) {
+ p != x->outputVectors().end(); ++p) {
bool found = false;
for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) {
@@ -173,4 +175,5 @@ void KstObjectItem::update(bool recursiv
_removable = x->getUsage() == 1;
x->readUnlock();
+ }
break;
}
More information about the Kst
mailing list