Bug 88425 - reload has no effect if indirect datasource didn't exist but now does
Summary: reload has no effect if indirect datasource didn't exist but now does
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-30 06:13 UTC by Matthew Truch
Modified: 2004-09-13 21:37 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-30 06:13:50 UTC
Version:           1.0.0_devel (using KDE KDE 3.2.2)
Installed from:    RedHat RPMs
OS:                Linux

If you open a .kst file that points to data that doesn't exist (for example, you forgot to mount your nfs filesystem with all your data), then make the data exist (in my example mount the filesystem), and click on reload, nothing happens.  I would expect that the data would now be loaded.  

For reference, in my case, it was an nfs mount, I was using an indirect file pointing to a dirfile, and both the indirect file and the dirfile were on the nfs mount.
Comment 1 Andrew Walker 2004-09-03 19:23:50 UTC
This works okay for the case of a missing ascii datasource, which is subequently created.
Comment 2 Andrew Walker 2004-09-03 19:27:47 UTC
Also works okay for a missing dirfile which is subsequently created.
Comment 3 Andrew Walker 2004-09-03 19:36:01 UTC
Also works okay for any combination of missing links and/or dirfiles (all on the local file system)
Comment 4 George Staikos 2004-09-13 21:30:04 UTC
Specific to indirect datasource, I see the problem in the code.
Comment 5 George Staikos 2004-09-13 21:37:15 UTC
CVS commit by staikos: 

allow indirect sources to hang around while what they point to isn't around,
but refresh pick it up later.  This does not address the issue of opening
an indirect file that doesn't exist on disk.  I'm not sure this is worth the
effort since it really doesn't make much sense.  I consider that part of the
report "WONTFIX".

CCMAIL: 88425-done@bugs.kde.org


  M +16 -14    indirect.cpp   1.6


--- kdeextragear-2/kst/kst/datasources/indirect/indirect.cpp  #1.5:1.6
@@ -23,6 +23,10 @@
 IndirectSource::IndirectSource(const QString& filename, KstDataSourcePtr child)
 : KstDataSource(filename, QString::null), _child(child) {
+  if (child) {
   _valid = true;
   _fieldList = child->fieldList();
+  } else {
+    _valid = false;
+  }
 }
 
@@ -38,9 +42,11 @@ KstObject::UpdateType IndirectSource::up
     QString ifn;
     if (0 < f.readLine(ifn, 1000)) {
-      if (ifn.stripWhiteSpace() != _child->fileName()) {
+      if (!_child || ifn.stripWhiteSpace() != _child->fileName()) {
+        _child = 0L; // release
         KstDataSourcePtr p = KstDataSource::loadSource(ifn.stripWhiteSpace());
         if (p) {
           _child = p;
           _fieldList = p->fieldList();
+          _valid = true;
         } else {
           _valid = false;
@@ -50,25 +56,25 @@ KstObject::UpdateType IndirectSource::up
   }
 
-  return _child->update(u);
+  return _child ? _child->update(u) : KstObject::NO_CHANGE;
 }
 
 
 int IndirectSource::readField(double *v, const QString& field, int s, int n) {
-  return _child->readField(v, field, s, n);
+  return _child ? _child->readField(v, field, s, n) : -1;
 }
 
 
 bool IndirectSource::isValidField(const QString& field) const {
-  return _child->isValidField(field);
+  return _child ? _child->isValidField(field) : false;
 }
 
 
 int IndirectSource::samplesPerFrame(const QString &field) {
-  return _child->samplesPerFrame(field);
+  return _child ? _child->samplesPerFrame(field) : 0;
 }
 
 
 int IndirectSource::frameCount(const QString& field) const {
-  return _child->frameCount(field);
+  return _child ? _child->frameCount(field) : 0;
 }
 
@@ -85,10 +91,10 @@ void IndirectSource::save(QTextStream &t
 
 bool IndirectSource::isValid() const {
-  return KstDataSource::isValid() && _child->isValid();
+  return KstDataSource::isValid() && _child && _child->isValid();
 }
 
 
 bool IndirectSource::isEmpty() const {
-  return _child->isEmpty();
+  return _child ? _child->isEmpty() : true;
 }
 
@@ -113,8 +119,4 @@ KstDataSource *create_indirect(const QSt
   f.close();
 
-  if (!p) {
-    return 0L;
-  }
-
   return new IndirectSource(filename, p);
 }