Bug #4146

Closing the main qnet window after modifying control net and hitting "Cancel" closes the main window

Added by Ian Humphrey almost 3 years ago. Updated 7 months ago.

Adam Goins
Target version:

Minimal - Affected applications include qnet, as well as QnetFileTool, and ViewportMainWindow.

Software Version:
Test Reviewer:


This occurs (on Fedora21) when running qnet and modifying a control network (by either changing points in an existing control network or creating a new control network).

When closing the main qnet window (clicking the window's close / X button), a prompt will appear:


The control network files have been modified.
Do you want to save your changes?

[Cancel] [No] [Yes]

Clicking Cancel will close the main qnet application window, but qnet will still be running.

This bug does not occur when using **File->Exit* or the CTRL-Q shortcut to quit and then clicking Cancel on the dialog.*


#1 Updated by Tammy Becker almost 3 years ago

  • Status changed from New to Acknowledged

#2 Updated by Adam Goins about 1 year ago

  • Assignee set to Adam Goins

#3 Updated by Adam Goins about 1 year ago

  • Status changed from Acknowledged to In Progress

#4 Updated by Adam Goins about 1 year ago

  • Status changed from In Progress to Resolved
  • Impact updated (diff)

This was caused because we connect the ViewportMainWindow::closeWindow() signal directly to the QnetFileTool::exit() slot.
The exit() slot prompts the popup dialogue, and if 'cancel' is selected it simply returns from the exit function. The CloseWindow() is emitted from the window's closeEvent() method, which emits that signal but then proceeds to close the application anyway with no regard to what happened in the listening exit() slot.
There was insufficient communication between these two programs.

The solution was to pass a pointer to the QCloseEvent object that ViewportMainWindow receives when closed, and pass that into the QnetFileTool's exit() slot so that we could set that QCloseEvent to be ignored if the "cancel" option was clicked.
These parameters were added as optional parameters to address backwards compatibility and not interfere with applications that were listening for a ViewportMainWindow::closeWindow() signal that wasn't populated with a QCloseEvent object.

Changes can be found in /work/projects/isis/latest/m04146 and have been built on prog24 for testing.

#5 Updated by Lynn Weller about 1 year ago

I was able to reproduce Ian's problem and verified the changes work as expected via astrovm4.

#6 Updated by Ian Humphrey about 1 year ago

Looks good! Tried to create a new control network, added a point, and closed. I was prompted with the dialog asking if I wanted to save changes or not, and hitting cancel brings back focus to qnet. It no longer closes the application.

Also available in: Atom PDF