Commit 300dff19 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

When using the getWidget() method in a Tool constructor, cannot assume a valid...

When using the getWidget() method in a Tool constructor, cannot assume a valid MosaicSceneWidget value.  Tools can be constructed with a Null MosaicSceneWidget.  This was causing a seg fault when accessing the qmos help.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce_FY17-Sprint1@7652 41f8697f-d340-4b68-9986-7bafba869bb8
parent 9e3d9e68
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -94,7 +94,10 @@ namespace Isis {
    connect(m_configMovement, SIGNAL(destroyed(QObject *)),
            this, SLOT(objectDestroyed(QObject *)));

    if (!getWidget()->directory()) {
    //  MosaicSceneWidget could be NULL because the MosaicSceneWidget::getControlNetHelp and
    //  MosaicSceneWidget::getGridHelp create tools passing in Null for the Widget.
    //  Why can't the getControlNetHelp and getGridHelp pass in the current MosaicSceneWidget?
    if (getWidget() && !getWidget()->directory()) {
      m_closeNetwork = new QPushButton("Close Network");
      m_closeNetwork->setEnabled(false);
      m_closeNetwork->setVisible(false);
@@ -110,6 +113,8 @@ namespace Isis {
      connect(m_loadControlNetButton, SIGNAL(destroyed(QObject *)),
              this, SLOT(objectDestroyed(QObject *)));

      connect(this, SIGNAL(controlPointSelected(ControlPoint *)),
              getWidget(), SIGNAL(controlPointSelected(ControlPoint *)));
    }

    m_controlNetFileLabel = new QLabel;
@@ -118,8 +123,6 @@ namespace Isis {
    connect(m_controlNetFileLabel, SIGNAL(destroyed(QObject *)),
            this, SLOT(objectDestroyed(QObject *)));

    connect(this, SIGNAL(controlPointSelected(ControlPoint *)),
            getWidget(), SIGNAL(controlPointSelected(ControlPoint *)));
  }


+4 −0
Original line number Diff line number Diff line
@@ -55,6 +55,10 @@ namespace Isis {
   *   @history 2017-01-03 Tracie Sucharski - If IPCE, set m_controlNet to active control net in the
   *                           loadNetwork method and do not display Load/Close Network button if
   *                           IPCE.
   *   @history 2017-05-11 Tracie Sucharski - Tools can be created with a Null value for the
   *                           MosaicSceneWidget, so need to check for Null value getWidget() in
   *                           Tool constructor.  This was causing a segfault when accessing qmos
   *                           help and a Qt connection error.
   */
  class MosaicControlNetTool : public MosaicTool {
      Q_OBJECT