[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Fri Oct 30 19:05:11 CET 2009
SVN commit 1042789 by netterfield:
Fix some more memory leaks.
M +8 -7 datasources/dirfilesource/dirfilesource.cpp
M +3 -0 datasources/dirfilesource/dirfilesource.h
M +2 -0 libkst/coredocument.cpp
M +1 -0 libkst/datasource.cpp
M +0 -7 libkst/datavector.cpp
M +0 -1 libkst/objectstore.cpp
M +1 -0 libkst/scalar.cpp
M +1 -1 libkst/vector.cpp
M +3 -0 libkstapp/application.cpp
M +1 -1 widgets/dialogdefaults.cpp
--- branches/work/kst/portto4/kst/src/datasources/dirfilesource/dirfilesource.cpp #1042788:1042789
@@ -64,14 +64,14 @@
init();
update();
- QFileSystemWatcher *watcher = new QFileSystemWatcher();
+ _watcher = new QFileSystemWatcher();
if (_fieldList.count() > 1) {
QString filePath = _dirfile->ReferenceFilename();
- watcher->addPath(filePath);
+ _watcher->addPath(filePath);
}
- connect(watcher, SIGNAL(fileChanged ( const QString & )), this, SLOT(checkUpdate()));
- connect(watcher, SIGNAL(directoryChanged ( const QString & )), this, SLOT(checkUpdate()));
+ connect(_watcher, SIGNAL(fileChanged ( const QString & )), this, SLOT(checkUpdate()));
+ connect(_watcher, SIGNAL(directoryChanged ( const QString & )), this, SLOT(checkUpdate()));
}
@@ -80,9 +80,10 @@
DirFileSource::~DirFileSource() {
delete _config;
_config = 0L;
- if (_dirfile) {
- delete _dirfile;
- }
+ delete _dirfile;
+ _dirfile = 0L;
+ delete _watcher;
+ _watcher = 0L;
}
--- branches/work/kst/portto4/kst/src/datasources/dirfilesource/dirfilesource.h #1042788:1042789
@@ -24,6 +24,8 @@
using namespace GetData;
+class QFileSystemWatcher;
+
class DirFileSource : public Kst::DataSource {
Q_OBJECT
@@ -75,6 +77,7 @@
private:
QString _directoryName;
Dirfile *_dirfile;
+ QFileSystemWatcher *_watcher;
int _frameCount;
mutable Config *_config;
--- branches/work/kst/portto4/kst/src/libkst/coredocument.cpp #1042788:1042789
@@ -33,6 +33,8 @@
CoreDocument::~CoreDocument() {
+ delete _objectStore;
+ _objectStore = 0;
}
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #1042788:1042789
@@ -66,6 +66,7 @@
static PluginList _pluginList;
void DataSource::cleanupForExit() {
_pluginList.clear();
+ delete settingsObject;
settingsObject = 0L;
// for (QMap<QString,QString>::Iterator i = urlMap.begin(); i != urlMap.end(); ++i) {
// KIO::NetAccess::removeTempFile(i.value());
--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #1042788:1042789
@@ -368,7 +368,6 @@
Object::UpdateType DataVector::update() {
Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);
- qDebug() << " data vector update: " << Name();
if (_file) {
_file->writeLock();
}
@@ -477,7 +476,6 @@
if (DoSkip) {
// reallocate V if necessary
- //qDebug() << "new_nf = " << new_nf << " and skip = " << Skip << " so new_nf/Skip+1 = " << (new_nf / Skip + 1) << endl;
if (new_nf / Skip != _size) {
bool rc = resize(new_nf/Skip);
if (!rc) {
@@ -494,7 +492,6 @@
} else {
rc = _file->readField(_v + _numSamples, _field, new_f0, (new_nf - NF)/Skip, Skip, &lastRead);
if (rc != -9999) {
- //qDebug() << "USED SKIP FOR READ - " << _field << " - rc=" << rc << " for Skip=" << Skip << " s=" << new_f0 << " n=" << (new_nf - NF)/Skip << endl;
if (rc >= 0) {
n_read = rc;
} else {
@@ -508,7 +505,6 @@
if (_dontUseSkipAccel) {
n_read = 0;
/** read each sample from the File */
- //qDebug() << "NF = " << NF << " numsamples = " << _numSamples << " new_f0 = " << new_f0 << endl;
double *t = _v + _numSamples;
int new_nf_Skip = new_nf - Skip;
if (DoAve) {
@@ -533,7 +529,6 @@
}
} else {
for (i = NF; new_nf_Skip >= i; i += Skip) {
- //qDebug() << "readField " << _field << " start=" << new_f0 + i << " n=-1" << endl;
n_read += _file->readField(t++, _field, new_f0 + i, -1);
}
}
@@ -563,7 +558,6 @@
n_read = _file->readField(_v+NF*SPF, _field, new_f0 + NF, new_nf - NF - 1);
n_read += _file->readField(_v+(new_nf-1)*SPF, _field, new_f0 + new_nf - 1, -1);
} else {
- //qDebug() << "Reading into _v=" << (void*)_v << " which has size " << _size << " and starting at offset " << NF*SPF << " for s=" << new_f0 + NF << " and n=" << new_nf - NF << endl;
assert(new_f0 + NF >= 0);
if (new_nf - NF > 0 || new_nf - NF == -1) {
n_read = _file->readField(_v+NF*SPF, _field, new_f0 + NF, new_nf - NF);
@@ -585,7 +579,6 @@
// As a first fix, mount all nsf mounted dirfiles with "-o noac"
_dirty = false;
if (_numSamples != _size && !(_numSamples == 0 && _size == 1)) {
- //qDebug() << "SET DIRTY since _numSamples = " << _numSamples << " but _size = " << _size << endl;
_dirty = true;
for (i = _numSamples; i < _size; i++) {
_v[i] = _v[0];
--- branches/work/kst/portto4/kst/src/libkst/objectstore.cpp #1042788:1042789
@@ -146,7 +146,6 @@
P->changeFile(new_data_source);
of.object->unlock();
}
- qDebug() << of.object->Name() << " " << of.filename;
}
newDataSourceList.clear();
--- branches/work/kst/portto4/kst/src/libkst/scalar.cpp #1042788:1042789
@@ -58,6 +58,7 @@
}
Scalar::~Scalar() {
+ qDebug() << "scalar destructor for: " << Name();
}
--- branches/work/kst/portto4/kst/src/libkst/vector.cpp #1042788:1042789
@@ -78,11 +78,11 @@
}
Vector::~Vector() {
- // qDebug() << "+++ DELETING VECTOR: " << (void*) this;
if (_v) {
free(_v);
_v = 0;
}
+ qDebug() << "destroying vector: rms scalar usage: " << _scalars["rms"]->getUsage();
}
--- branches/work/kst/portto4/kst/src/libkstapp/application.cpp #1042788:1042789
@@ -30,6 +30,8 @@
QCoreApplication::setApplicationName("Kst");
+ _dialogDefaults = new QSettings("kst", "dialog");
+
Builtins::initPrimitives(); //libkst
Builtins::initDataSources(); //libkst
Builtins::initObjects(); //libkstmath
@@ -52,6 +54,7 @@
Application::~Application() {
delete _mainWindow;
+ delete _dialogDefaults;
}
--- branches/work/kst/portto4/kst/src/widgets/dialogdefaults.cpp #1042788:1042789
@@ -12,7 +12,7 @@
#include "dialogdefaults.h"
namespace Kst {
- QSettings *_dialogDefaults = new QSettings("kst", "dialog");
+ QSettings *_dialogDefaults;
void setDataVectorDefaults(DataVectorPtr V) {
_dialogDefaults->setValue("vector/datasource", V->filename());
More information about the Kst
mailing list