Bug 135171 - deadlock in new plot dialog
Summary: deadlock in new plot dialog
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: ui (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR grave
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-05 23:26 UTC by George Staikos
Modified: 2010-08-14 14:40 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 George Staikos 2006-10-05 23:26:15 UTC
Not sure how to reproduce yet.

#4  0x420d9676 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/tls/libpthread.so.0
#5  0x40ad56ad in KstWaitCondition::wait (this=0x85f9058, mutex=0x85f9050,
    time=4294967295)
    at kst/src/libkst/kstwaitcondition_unix.cpp:309
#6  0x40a97a78 in KstRWLock::readLock (this=0x85f904c)
    at kst/src/libkst/rwlock.cpp:55
#7  0x40203d62 in View2DPlotWidget::updateScalarCombo (this=0x866bbb0)
    at view2dplotwidget.ui.h:403
#8  0x40205610 in View2DPlotWidget::fillWidget (this=0x866bbb0, 
plot=0x8629ca0)
    at view2dplotwidget.ui.h:496
#9  0x4029a51e in Kst2DPlot::fillConfigWidget (this=0x8629ca0, w=0x866bbb0,
    isNew=false)
    at kst/src/libkstapp/kst2dplot.cpp:6906
#10 0x40354459 in KstEditViewObjectDialogI::updateWidgets (this=0xbfffe2f0)
    at kst/src/libkstapp/ksteditviewobjectdialog_i.cpp:119
#11 0x40353bda in KstEditViewObjectDialogI::showEditViewObjectDialog (
    this=0xbfffe2f0, viewObject=Cannot access memory at address 0xfffffffc
)
    at kst/src/libkstapp/ksteditviewobjectdialog_i.cpp:81
#12 0x402f42b6 in KstViewObject::showDialog (this=0x8629ca0, invoker=
      {ptr = 0x865b818}, isNew=false)
    at kst/src/libkstapp/kstviewobject.cpp:1929
#13 0x40281cad in Kst2DPlot::mousePressEvent (this=0x8629ca0, view=0x865bb08,
    e=0xbfffe830)
    at kst/src/libkstapp/kst2dplot.cpp:4220
#14 0x402d4d88 in KstViewWidget::mousePressEvent (this=0x865bb08, 
e=0xbfffe830)
    at kst/src/libkstapp/kstviewwidget.cpp:214
#15 0x419be2ff in QWidget::event (this=0x865bb08, e=0xbfffe830)
    at qwidget.cpp:4667
Comment 1 George Staikos 2006-10-06 06:34:24 UTC
SVN commit 592888 by staikos:

Remove some deadlock cases
BUG: 135171
BUG: 135176


 M  +15 -12    kstdoc.cpp  
 M  +5 -3      updatethread.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstdoc.cpp #592887:592888
@@ -792,14 +792,25 @@
     }
   }
 
+  KST::dataObjectList.lock().writeLock();
+  // Avoid deadlock in DataObject destructor
+  KstDataObjectList tmpDol = QDeepCopy<KstDataObjectList>(KST::dataObjectList);
+  KST::dataObjectList.clear();
+  KST::dataObjectList.lock().unlock();
+  tmpDol.clear();
+
+  KST::dataSourceList.lock().writeLock();
+  KST::dataSourceList.clear();
+  KST::dataSourceList.lock().unlock();
+
+  KST::matrixList.lock().writeLock();
+  KST::matrixList.clear();
+  KST::matrixList.lock().unlock();
+
   KST::vectorList.lock().writeLock();
   KST::vectorList.clear();
   KST::vectorList.lock().unlock();
   
-  KST::matrixList.lock().writeLock();
-  KST::matrixList.clear();
-  KST::matrixList.lock().unlock();
-
   KST::scalarList.lock().writeLock();
   KST::scalarList.clear();
   KST::scalarList.lock().unlock();
@@ -808,14 +819,6 @@
   KST::stringList.clear();
   KST::stringList.lock().unlock();
 
-  KST::dataSourceList.lock().writeLock();
-  KST::dataSourceList.clear();
-  KST::dataSourceList.lock().unlock();
-
-  KST::dataObjectList.lock().writeLock();
-  KST::dataObjectList.clear();
-  KST::dataObjectList.lock().unlock();
-
   emit updateDialogs();
 }
 
--- trunk/extragear/graphics/kst/src/libkstapp/updatethread.cpp #592887:592888
@@ -19,6 +19,8 @@
 
 #include <assert.h>
 
+#include <qdeepcopy.h>
+
 #include "ksdebug.h"
 
 #include "kstdatacollection.h"
@@ -234,7 +236,9 @@
     KstScalar::clearScalarsDirty(); // Must do this first and take a risk of
                                     // falling slightly behind
     KST::scalarList.lock().readLock();
-    for (KstScalarList::ConstIterator i = KST::scalarList.begin(); i != KST::scalarList.end(); ++i) {
+    KstScalarList sl = QDeepCopy<KstScalarList>(KST::scalarList); // avoid deadlock on exit
+    KST::scalarList.lock().unlock();
+    for (KstScalarList::ConstIterator i = sl.begin(); i != sl.end(); ++i) {
       KstScalarPtr sp = *i;
 
       sp->writeLock();
@@ -246,11 +250,9 @@
       }
 
       if (_done) {
-        KST::scalarList.lock().unlock();
         return false;
       }
     }
-    KST::scalarList.lock().unlock();
   }
 
   if (U == KstObject::UPDATE) {
Comment 2 Peter Kümmel 2010-08-14 14:40:51 UTC
Change version to 1.x