Bug 118807 - Change data file bug causes inconsistent state
Summary: Change data file bug causes inconsistent state
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Solaris
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-21 17:40 UTC by Nicolas Brisset
Modified: 2005-12-22 06: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 Nicolas Brisset 2005-12-21 17:40:59 UTC
Version:           1.2.0_devel (using KDE 3.4.0, compiled sources)
Compiler:          gcc version 3.4.3
OS:                SunOS (sun4u) release 5.8

I don't know how bad that can become (crashes ?), but it is certainly not clean. To reproduce:

- load vector 1 vs INDEX from gyrodata.dat with the datawizard
- go to the plot, and show the legend
- Tools->Change data file: select both vectors, check duplicate with dependents, select the same gyrodata.dat file (the problem was found using different data files, but this is simpler to test)
- Hit "Apply": two new vectors are created and one curve is added to the plot (so far, so good)
- select the first 2 vectors again, and hit "Apply" again
- 1'' and INDEX'' get created, and one curve is added to the legend with the same name as the previous one. However, it does not appear in the data manager !!
- plot dialog->Content: remove the last curve, apply: it goes away
- try to add the last curve again, when you hit apply it can't be added because kst thinks it's already there

There are other weird effects throughout kst, and I don't know how bad it can become. But this certainly needs to be fixed. I don't know whether the problem is name truncation due to the "'" characters being appended (and linked with bug #118737). Note that the data wizard appends "-[number]" in the same case).
Comment 1 George Staikos 2005-12-22 06:24:52 UTC
SVN commit 490490 by staikos:

don't add a curve to a plot twice
BUG:118807


 M  +1 -1      kstchangefiledialog_i.cpp  


--- trunk/extragear/graphics/kst/kst/kstchangefiledialog_i.cpp #490489:490490
@@ -257,7 +257,7 @@
           for (Kst2DPlotList::Iterator plotIter = plots.begin(); plotIter != plots.end(); ++plotIter) {
             for (KstDataObjectDataObjectMap::ConstIterator iter = duplicatedMap.begin(); iter != duplicatedMap.end(); ++iter) {
               if (KstBaseCurvePtr curve = kst_cast<KstBaseCurve>(iter.data())) {
-                if ((*plotIter)->Curves.contains(kst_cast<KstBaseCurve>(iter.key()))) {
+                if (!(*plotIter)->Curves.contains(kst_cast<KstBaseCurve>(iter.key()))) {
                   (*plotIter)->addCurve(curve);
                 }
               }