Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Fixed crash on MacOS when resetting a greyed dialog parent #1539

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/1538.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed crash on MacOS when closing a dialog
10 changes: 7 additions & 3 deletions parsec/core/gui/custom_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def on_finished(self):
):
getattr(self.center_widget, "on_close")()
self.closing.emit()
self.setParent(None)
# On Windows, GreyedDialogs don't get cleared out if their parent
# is not set to None. Linux seems to clear them automatically over time.
# Resetting the parent on MacOS causes a crash.
if platform.system() != "Darwin":
self.setParent(None)


class TextInputWidget(QWidget, Ui_InputWidget):
Expand Down Expand Up @@ -264,7 +268,7 @@ def toggle_details(self, checked):
def show_error(parent, message, exception=None):
w = ErrorWidget(message, exception)
d = GreyedDialog(w, title=_("TEXT_ERR_DIALOG_TITLE"), parent=parent)
return d.exec_()
return d.open()


class InfoWidget(QWidget, Ui_InfoWidget):
Expand Down Expand Up @@ -292,4 +296,4 @@ def show_info(parent, message, button_text=None):
d = GreyedDialog(w, title=None, parent=parent, hide_close=True)
w.dialog = d
w.button_ok.setFocus()
return d.exec_()
return d.open()
3 changes: 3 additions & 0 deletions tests/core/gui/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ def _dialog_exec(dialog):
monkeypatch.setattr(
"parsec.core.gui.custom_dialogs.GreyedDialog.exec_", _dialog_exec, raising=False
)
monkeypatch.setattr(
"parsec.core.gui.custom_dialogs.GreyedDialog.open", _dialog_exec, raising=False
)
return spy


Expand Down