Summary: | reload has no effect if indirect datasource didn't exist but now does | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Matthew Truch <matt> |
Component: | general | Assignee: | George Staikos <staikos> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Matthew Truch
2004-08-30 06:13:50 UTC
This works okay for the case of a missing ascii datasource, which is subequently created. Also works okay for a missing dirfile which is subsequently created. Also works okay for any combination of missing links and/or dirfiles (all on the local file system) Specific to indirect datasource, I see the problem in the code. 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); } |