Mercurial > hg > svcore
changeset 943:178ffa964096 tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 02 Jul 2014 17:31:21 +0100 |
parents | f960d67ce842 (current diff) 0009b2b066e0 (diff) |
children | a6bfe009523a 5f7b509a441a |
files | |
diffstat | 2 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/base/Debug.cpp Wed Jun 18 13:42:01 2014 +0100 +++ b/base/Debug.cpp Wed Jul 02 17:31:21 2014 +0100 @@ -34,14 +34,16 @@ static QDebug *debug = 0; static QMutex mutex; static char *prefix; + mutex.lock(); + if (!debug) { prefix = new char[20]; sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid()); QString pfx = ResourceFinder().getUserResourcePrefix(); QDir logdir(QString("%1/%2").arg(pfx).arg("log")); if (!logdir.exists()) logdir.mkpath(logdir.path()); - logFile = new QFile(logdir.path() + "/debug.log"); + logFile = new QFile(logdir.path() + "/sv-debug.log"); if (logFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) { QDebug(QtDebugMsg) << (const char *)prefix << "Opened debug log file " @@ -59,10 +61,12 @@ *debug << endl << (const char *)prefix << "Log started at " << QDateTime::currentDateTime().toString(); } - mutex.unlock(); QDebug &dref = *debug; - return dref << endl << (const char *)prefix; + dref << endl << (const char *)prefix; + + mutex.unlock(); + return dref; } QDebug &
--- a/data/model/EditableDenseThreeDimensionalModel.cpp Wed Jun 18 13:42:01 2014 +0100 +++ b/data/model/EditableDenseThreeDimensionalModel.cpp Wed Jul 02 17:31:21 2014 +0100 @@ -157,7 +157,7 @@ EditableDenseThreeDimensionalModel::getColumn(int index) const { QReadLocker locker(&m_lock); - if (int(index) >= m_data.size()) return Column(); + if (index < 0 || index >= m_data.size()) return Column(); return expandAndRetrieve(index); } @@ -287,7 +287,7 @@ { // See comment above m_trunc declaration in header - assert(int(index) < m_data.size()); + assert(index >= 0 && index < int(m_data.size())); Column c = m_data.at(index); if (index == 0) { return c; @@ -301,7 +301,7 @@ if (trunc < 0) { top = false; tdist = -trunc; } Column p = expandAndRetrieve(index - tdist); int psize = p.size(), csize = c.size(); - if (psize != int(m_yBinCount)) { + if (psize != m_yBinCount) { cerr << "WARNING: EditableDenseThreeDimensionalModel::expandAndRetrieve: Trying to expand from incorrectly sized column" << endl; } if (top) { @@ -390,7 +390,7 @@ QString EditableDenseThreeDimensionalModel::getBinName(int n) const { - if ((int)m_binNames.size() > n) return m_binNames[n]; + if (n >= 0 && (int)m_binNames.size() > n) return m_binNames[n]; else return ""; }