Commit 1c9f0926 authored by Cole Neubauer's avatar Cole Neubauer
Browse files

The return values from workorder accessors are more reliable and the...

The return values from workorder accessors are more reliable and the infrastructure to handle workorder threads is in place Fixes #5082

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7904 41f8697f-d340-4b68-9986-7bafba869bb8
parent bcb4d5c0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2276,6 +2276,16 @@ namespace Isis {
  }


 /**
  * This function returns a QMutex. This was needed to be able to deal with a threading issue with
  * Work Order functions returning a member variable. This is used by creating a QMutexLocker
  * inside of a function accessing a member variable and using the returned QMutex from this
  * function as a parameter. Because the QMutexLocker was created in the function accessing the
  * member variable when the function exits the QMutexLocker is destroyed and the QMutex is
  * unlocked.
  *
  * @return QMutex
  */
  QMutex *Project::workOrderMutex() {
    return m_workOrderMutex;
  }
+2 −0
Original line number Diff line number Diff line
@@ -154,6 +154,8 @@ namespace Isis {
   *                           allow for opening of a new project. Fixes #4969
   *   @history 2017-07-27 Cole Neubauer - Added check before emmiting workOrderStarting()
   *                           Fixes #4715
   *   @history 2017-07-27 Cole Neubauer - Added a workordermutex to be used in workorder accessors
   *                           Fixes #5082
   */
  class Project : public QObject {
    Q_OBJECT
+24 −0
Original line number Diff line number Diff line
@@ -603,6 +603,7 @@ namespace Isis {
   * @return @b (ImageList*) A pointer to the ImageList.
   */
  ImageList *WorkOrder::imageList() {
    QMutexLocker locker(project()->workOrderMutex());
    if (!m_imageList) {
      bool anyImagesAreNull = false;

@@ -634,6 +635,7 @@ namespace Isis {
   * @return @b (ShapeList*) A pointer to the ShapeList.
   */
  ShapeList *WorkOrder::shapeList() {
    QMutexLocker locker(project()->workOrderMutex());
    if (!m_shapeList) {
      bool anyShapesAreNull = false;

@@ -666,6 +668,7 @@ namespace Isis {
   * @return A CorrelationMatrix.
   */
  CorrelationMatrix WorkOrder::correlationMatrix() {
    QMutexLocker locker(project()->workOrderMutex());
    return m_correlationMatrix;
  }

@@ -675,6 +678,7 @@ namespace Isis {
   * @return QPointer<ControlList>  Returns m_controlList.
   */
  QPointer<ControlList> WorkOrder::controlList() {
    QMutexLocker locker(project()->workOrderMutex());
    return m_controlList;
  }

@@ -704,6 +708,7 @@ namespace Isis {
   * @return @b QSharedPointer Returns a shared pointer to the TargetBody.
   */
  TargetBodyQsp WorkOrder::targetBody() {
    QMutexLocker locker(project()->workOrderMutex());
    return m_targetBody;
  }

@@ -713,6 +718,7 @@ namespace Isis {
   * @return @b QSharedPointer Returns a shared pointer to the guiCamera.
   */
  GuiCameraQsp WorkOrder::guiCamera() {
    QMutexLocker locker(project()->workOrderMutex());
    return m_guiCamera;
  }

@@ -722,6 +728,7 @@ namespace Isis {
   * @return @b QSharedPointer Returns a shared pointer to the fileItem.
   */
  FileItemQsp WorkOrder::fileItem() {
    QMutexLocker locker(project()->workOrderMutex());
    return m_fileItem;
  }

@@ -771,6 +778,7 @@ namespace Isis {
   * @return @b (bool) Returns True if this work order is undoable, false if it is not.
   */
  bool WorkOrder::isUndoable() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_isUndoable;
  }

@@ -792,6 +800,7 @@ namespace Isis {
   * @return @b (bool) Returns True if this work order is run synchronously
   */
  bool WorkOrder::isSynchronous() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_isSynchronous;
  }

@@ -801,6 +810,7 @@ namespace Isis {
   * @return @b Returns True if the Project has been saved to disk.  False if it has not.
   */
  bool WorkOrder::createsCleanState() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_createsCleanState;
  }

@@ -810,6 +820,7 @@ namespace Isis {
   * @return @b QDateTime The execution time.
   */
  QDateTime WorkOrder::executionTime() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_executionTime;
  }

@@ -828,6 +839,7 @@ namespace Isis {
   * @return @b bool Returns True if the WorkOrder is executing a redo.  Returns False if it is not.
   */
  bool WorkOrder::isRedoing() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_status == WorkOrderRedoing;
  }

@@ -837,6 +849,7 @@ namespace Isis {
   * @return @b bool Returns True if the WorkOrder has completed a Redo.  False if it has not.
   */
  bool WorkOrder::isRedone() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_status == WorkOrderRedone;
  }

@@ -846,6 +859,7 @@ namespace Isis {
   * @return @b bool Returns True if the current status is WorkOrderUndoing, False otherwise.
   */
  bool WorkOrder::isUndoing() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_status == WorkOrderUndoing;
  }

@@ -855,6 +869,7 @@ namespace Isis {
   * @return @b bool Returns True if the WorkOrder has been undone.  False if it has not.
   */
  bool WorkOrder::isUndone() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_status == WorkOrderUndone;
  }

@@ -865,6 +880,7 @@ namespace Isis {
   * it's actions.  Returns False if it has not.
   */
  bool WorkOrder::modifiesDiskState() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_modifiesDiskState;
  }

@@ -874,6 +890,7 @@ namespace Isis {
   * @return @b QPointer pointing to the next WorkOrder.
   */
  WorkOrder *WorkOrder::next() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_nextWorkOrder;
  }

@@ -883,6 +900,7 @@ namespace Isis {
   * @return @b QPointer pointing to the previous WorkOrder.
   */
  WorkOrder *WorkOrder::previous() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_previousWorkOrder;
  }

@@ -892,6 +910,7 @@ namespace Isis {
   * @return @b QString A string representation of the current WorkOrder status.
   */
  QString WorkOrder::statusText() const {
    QMutexLocker locker(project()->workOrderMutex());
    QString result = toString(m_status);

    if (m_secondsElapsed) {
@@ -912,6 +931,7 @@ namespace Isis {
   * @return A QPointer to the ProgessBar.
   */
  ProgressBar *WorkOrder::progressBar() {
    QMutexLocker locker(project()->workOrderMutex());
    return m_progressBar;
  }

@@ -1262,6 +1282,7 @@ namespace Isis {
   * @return @b int The minimum value.
   */
  int WorkOrder::progressMin() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_progressRangeMinValue;
  }

@@ -1271,6 +1292,7 @@ namespace Isis {
   * @return @b int The maximum value.
   */
  int WorkOrder::progressMax() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_progressRangeMaxValue;
  }

@@ -1280,6 +1302,7 @@ namespace Isis {
   * @return @b int Returns the current progress value.
   */
  int WorkOrder::progressValue() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_progressValue;
  }

@@ -1309,6 +1332,7 @@ namespace Isis {
   * @return @b QStringList Returns the internal data object.
   */
  QStringList WorkOrder::internalData() const {
    QMutexLocker locker(project()->workOrderMutex());
    return m_internalData;
  }

+2 −0
Original line number Diff line number Diff line
@@ -301,6 +301,8 @@ namespace Isis {
   *                           BundleObservationViewWorkOrder. Fixes #4838, #4839, #4840.
   *   @history 2017-07-24 Cole Neubauer - Created isSavedToHistory() to be able to keep Views from
   *                           being added to the HistoryTree Fixes #4715
   *   @history 2017-07-31 Cole Neubauer - Added a QTMutexLocker to every function that returns a
   *                           member variable function Fixes #5082
   */
  class WorkOrder : public QAction, public QUndoCommand {
    Q_OBJECT