Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyface/ui/qt/progress_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def update(self, value):
# Private Interface
# -------------------------------------------------------------------------

def reject(self, event):
def reject(self, event = None):
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no space before the equal sign in the default parameter assignment. According to PEP 8, the correct format is "event=None" not "event = None".

Copilot uses AI. Check for mistakes.
self._user_cancelled = True
self.close()

Expand Down Expand Up @@ -201,7 +201,7 @@ def _create_buttons(self, dialog, layout):
# TODO: hookup the buttons to our methods, this may involve subclassing from QDialog

if self.can_cancel:
buttons.rejected.connect(dialog.reject)
buttons.rejected.connect(self.reject)
self._connections_to_remove.append(
(buttons.rejected, dialog.reject)
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handler stored in _connections_to_remove should be self.reject to match the actual connected handler on line 204. Currently, dialog.reject is stored, which means the signal disconnection in the destroy() method will attempt to disconnect the wrong handler, potentially leaving the connection active and causing memory leaks.

Suggested change
(buttons.rejected, dialog.reject)
(buttons.rejected, self.reject)

Copilot uses AI. Check for mistakes.
)
Comment on lines 203 to 207
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR fixes a critical bug where the Cancel button doesn't properly set the _user_cancelled flag, but there's no test coverage for this behavior. Consider adding a test that verifies clicking the cancel button properly sets _user_cancelled to True and that the update method returns the correct cancellation status.

Copilot uses AI. Check for mistakes.
Expand Down
Loading