Commit 3688801e authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Fixed seg faults caused by changing an active control and discarding edits on...

Fixed seg faults caused by changing an active control and discarding edits on previous active control.
parent b9b025a9
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -104,12 +104,7 @@ namespace Isis {
      connect(m_directory, SIGNAL( newWidgetAvailable(QWidget *) ),
              this, SLOT( addView(QWidget *) ) );

      // Currently this connection is only used by Directory when a new active is chosen & user
      // chooses to discard any edits in the old active control which is in a CnetEditorWidget.
      // The only view which will not be updated with the new control are any CnetEditorViews
      // showing the old active control.  CnetEditorWidget classes do not have the ability to reload
      // a control net, so the CnetEditor view displaying the old control is removed, then recreated.
      connect(m_directory, SIGNAL(viewClosed(QWidget *)),
      connect(m_directory, SIGNAL(closeView(QWidget *)),
              this, SLOT(removeView(QWidget *)));

      connect(m_directory, SIGNAL( directoryCleaned() ),
@@ -252,15 +247,16 @@ namespace Isis {


  /**
   * This slot is connected from Directory::viewClosed(QWidget *) signal.  It will
   * close the given view and delete the view. This was written to handle
   * This slot is connected from Directory::closeView(QWidget *) signal.  It will close the given 
   * view and delete the view. 
   *
   * @param view QWidget* The view to close.
   */
  void IpceMainWindow::removeView(QWidget *view) {

    view->close();
    delete view;
    QDockWidget *parentDock = qobject_cast<QDockWidget *>(view->parent());
    removeDockWidget(parentDock);
    delete parentDock;
  }


+6 −0
Original line number Diff line number Diff line
@@ -176,6 +176,12 @@ namespace Isis {
   *                           project was in fullscreen or not when saved. If not, we call showNormal()
   *                           to restore the poject's window size. This also fixes the warning/history tabs
   *                           being misplaced when opening a project. Fixes #5175.
   *   @history 2018-07-12 Tracie Sucharski - Renamed the signal Directory::viewClosed to
   *                           Directory::closeView since Directory does not close the view but
   *                           indicate that the view needs closing.  This signal is now used by
   *                           more than the cnetEditorView, so updated documentation.  Did a little
   *                           cleanup on the removeView  method by removing some code that
   *                           automatically happens due to connection made on destroyed signal.
   */
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT
+9 −4
Original line number Diff line number Diff line
@@ -555,19 +555,24 @@ namespace Isis {

    foreach(CnetEditorView *cnetEditorView, m_cnetEditorViewWidgets) {
      if (cnetEditorView->control() == project()->activeControl()) {
        emit viewClosed(cnetEditorView);
        project()->activeControl()->closeControlNet();
        project()->activeControl()->openControlNet();
        emit closeView(cnetEditorView);
        addCnetEditorView(project()->activeControl());
      }
    }
  }


/**
 * @description This slot is connected from the signal activeControlSet(bool) emitted from Project. 
 *  
 * 
 * @param newControl bool
 *
 */
  void Directory::newActiveControl(bool newControl) {

    if (newControl && m_controlPointEditViewWidget) {
     emit viewClosed(m_controlPointEditViewWidget);
     emit closeView(m_controlPointEditViewWidget);
     delete m_controlPointEditViewWidget;
    }

+5 −1
Original line number Diff line number Diff line
@@ -259,6 +259,10 @@ namespace Isis {
   *                           objectName needs to be created.
   *   @history 2018-07-09 Kaitlyn Lee - Uncommented code that closes a ControlPointEditView when a new
   *                           active control is set.
   *   @history 2018-07-12 Tracie Sucharski - Renamed viewClosed signal to closeView. Moved
   *                           the close/open control net from reloadActiveControlInCnetEditorView
   *                           to Project::setActiveControl to prevent seg fault when there are
   *                           multiple cnetEditorViews with same cnet.
   */
  class Directory : public QObject {
    Q_OBJECT
@@ -386,7 +390,7 @@ namespace Isis {
      void newDockAvailable(QMainWindow *newWidget);
      void newWidgetAvailable(QWidget *newWidget);

      void viewClosed(QWidget *widget);
      void closeView(QWidget *widget);

      void cnetModified();
      void redrawMeasures();
+9 −3
Original line number Diff line number Diff line
@@ -148,11 +148,12 @@ namespace Isis {
    // In ipce, we want it to be disabled if an active control is not set.
    foreach (QAction *action, m_toolPad->actions()) {
      if (action->toolTip() == "Control Net (c)") {
        m_controlNetTool = action;
        m_controlNetToolAction = action;
      }
    }
    if (!directory->project()->activeControl()) {
      m_controlNetTool->setEnabled(false);
      qDebug()<<"Footprint2DView constructor  set controlNetTool disabled";
      m_controlNetToolAction->setEnabled(false);
    }

    setAcceptDrops(true);
@@ -326,7 +327,12 @@ namespace Isis {
   * @param value The boolean that holds if a control network has been set.
   */
  void Footprint2DView::enableControlNetTool(bool value) {
    m_controlNetTool->setEnabled(value);
    m_controlNetToolAction->setEnabled(value);
    if (value) {
      MosaicControlNetTool *cnetTool =
              static_cast<MosaicControlNetTool *>(m_controlNetToolAction->parent());
      cnetTool->loadNetwork();
    }
  }


Loading