Commit f9120801 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

(Qt5) Modified ProcessByBrick::BlockingReportProgress to unlock QMutex before...

(Qt5) Modified ProcessByBrick::BlockingReportProgress to unlock QMutex before it is destroyed. This fixes extraneous output in app tests. Modified findfeatures' QDebugLogger so /dev/null is not opened with append mode.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/v006LibrariesV2@6710 41f8697f-d340-4b68-9986-7bafba869bb8
parent 218a8fe5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -503,6 +503,7 @@ namespace Isis {
    int lastProgressValue = future.progressValue();
    // Using a mutex with a timeout isn't as bad of a hack as inheriting QThread
    //   but there ought to be a better way.
    // Does having a local mutex make sense?
    QMutex sleeper;
    sleeper.lock();
    while (!future.isFinished()) {
@@ -524,6 +525,9 @@ namespace Isis {
      p_progress->CheckStatus();
      isisReportedProgress++;
    }

    // Need to unlock the mutex before it goes out of scope, otherwise Qt5 issues a warning
    sleeper.unlock();
  }


+5 −4
Original line number Diff line number Diff line
@@ -85,10 +85,11 @@ namespace Isis {
   *                           existing methods rather than duplicating code.
   *                           Added SetOutputCube() method.References #1248.
   *   @history 2015-01-15 Sasha Brownsberger - Added virtual keyword to several 
   *                                            functions to ensure successful 
   *                                            inheritance between Process and its
   *                                            child classes.  Also made destructor
   *                                            virtual.  Fixes #2215.
   *                           functions to ensure successful inheritance between Process and its
   *                           child classes.  Also made destructor virtual.  Fixes #2215.
   *   @history 2016-04-26 Ian Humphrey - Modified BlockingReportProgress() so that it unlocks
   *                           the local QMutex before it goes out of scope (Qt5 issues a warning
   *                           if a locked QMutex is destroyed).
   */
  class ProcessByBrick : public Process {
    public:
+5 −1
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ typedef QSharedPointer<QDebugLogger> QDebugStream;
 * @author 2015-09-09 Kris Becker 
 * @internal 
 *   @history 2015-09-09 Kris Becker - Original Version 
 *   @history 2016-04-26 Ian Humphrey - Modified open mode for /dev/null so that QIODevice::Append
 *                           is not set. This causes a seek to occur (to end of device) on a
 *                           sequential device (see Qt5 documentation on QIODevice::isSequential),
 *                           which Qt5 does not allow.
 */

class QDebugLogger {
@@ -131,7 +135,7 @@ class QDebugLogger {
    }

    static QDebugStream null() {
      return ( create( "/dev/null" ) );
      return ( create( "/dev/null", QIODevice::WriteOnly | QIODevice::Unbuffered ) );
    }