Skip to content

ManagerDeviceList: Guard double-click against duplicate operations#3205

Open
gfrmin wants to merge 3 commits into
blueman-project:mainfrom
gfrmin:doubleclickguard
Open

ManagerDeviceList: Guard double-click against duplicate operations#3205
gfrmin wants to merge 3 commits into
blueman-project:mainfrom
gfrmin:doubleclickguard

Conversation

@gfrmin
Copy link
Copy Markdown

@gfrmin gfrmin commented Apr 14, 2026

A quick second double-click on a device row while a connect/disconnect is still in flight currently fires a second connect_service/disconnect_service call. This can lead to duplicate BlueZ requests and confusing UI state.

Check menu.get_op(device) before initiating, and skip if an operation is already tracked for that device.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

if event.type == Gdk.EventType._2BUTTON_PRESS and cast(Gdk.EventButton, event).button == 1:
if self.menu.show_generic_connect_calc(row["device"]['UUIDs']):
if self.menu.get_op(row["device"]):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can check this as soon as we have a valid row so please move this to earlier in the function. This will most likely also make SonarCloud happy.

Guy Freeman and others added 2 commits April 18, 2026 21:14
Hoist the in-progress operation check out of the nested double-click
branch to right after self.menu is ensured. Besides addressing review
feedback and flattening one level of nesting (so SonarCloud is happy
about maintainability), the guard now also covers the right-click
popup path, which should not appear mid-operation either.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cognitive complexity of _on_event_clicked is one point over SonarCloud's
threshold; the else-branch after the posdata guard return is the obvious
redundancy. Equivalent behavior, one less complexity point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants