Bug 88357 - crash when changing curve name while viewing live data
Summary: crash when changing curve name while viewing live data
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: RedHat Enterprise Linux Linux
: NOR crash
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-29 04:19 UTC by Matthew Truch
Modified: 2004-08-30 21:24 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Truch 2004-08-29 04:19:28 UTC
Version:           1.0.0_devel (using KDE KDE 3.2.2)
Installed from:    RedHat RPMs
OS:                Linux

When viewing live data, sometimes (not always) when you edit a curve name, kst will crash.

How to reproduce.  View some live data.  The more data and the more often you update (aka don't skip frames, kst refresh set low) the more likely it seems to happen.  Go to the data manager and double click on a curve (or get to the curve dialog some other way), and change the unique name of the curve and click ok.  Often the curve will aquire the new name and everything is fine; sometimes kst will crash.  

Expected Behavior: kst doesn't crash.  :-)

Command line output:
[matt@cherry matt]$ kst thermometry.kst
kst: kstdatamanager_i.cpp:133: void KstObjectItem::update(bool, int): Assertion `x.data()' failed.
KCrash: Application 'kst' crashing...
[matt@cherry matt]$

Backtrace:
#0  0x00f44402 in ?? ()
#1  0x008aceab in __waitpid_nocancel () from /lib/tls/libpthread.so.0
#2  0x00228b60 in KCrash::defaultCrashHandler () from /usr/lib/libkdecore.so.4
#3  <signal handler called>
#4  0x00f44402 in ?? ()
#5  0x00670e49 in raise () from /lib/tls/libc.so.6
#6  0x00672872 in abort () from /lib/tls/libc.so.6
#7  0x0066a718 in __assert_fail () from /lib/tls/libc.so.6
#8  0x080e0c99 in KstObjectItem::update ()
#9  0x080e2d7a in KstDataManagerI::updateContents ()
#10 0x08146026 in KstApp::updateDataDialogs ()
#11 0x081473c0 in KstApp::qt_invoke ()
#12 0x0639a21c in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#13 0x0639a044 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#14 0x0813a4d5 in KstDoc::dataChanged ()
#15 0x08139926 in KstDoc::event ()
#16 0x0633dcdf in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#17 0x0633d2de in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#18 0x00194229 in KApplication::notify () from /usr/lib/libkdecore.so.4
#19 0x0633ead6 in QApplication::sendPostedEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#20 0x0633e956 in QApplication::sendPostedEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#21 0x062e7b6a in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#22 0x0634ff28 in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#23 0x0634fdd8 in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#24 0x0633df31 in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#25 0x0814bac3 in main ()
#26 0x0065ead4 in __libc_start_main () from /lib/tls/libc.so.6
#27 0x0806b80d in _start ()
Comment 1 Andrew Walker 2004-08-30 21:24:40 UTC
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@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;
       }