Skip to content

Handle unordered add / position change events#1555

Open
StefansM wants to merge 1 commit into
falkTX:mainfrom
StefansM:bugfix/UnorderedCallbacks
Open

Handle unordered add / position change events#1555
StefansM wants to merge 1 commit into
falkTX:mainfrom
StefansM:bugfix/UnorderedCallbacks

Conversation

@StefansM

Copy link
Copy Markdown
Contributor

Fixes (some cases of) plugins ignoring saved (x, y) coordinates when a
project is loaded. The canvas can get notified of a plugin's position
before the plugin is actually added, so when the plugin is actually it
just goes to the default position.

This happens because PatchbayClientPositionChanged events can arrive
before PatchbayClientAdded events, as seen in debug logs like this:

...
PatchCanvas::joinGroup(30)
PatchCanvas::joinGroup(30) - unable to find groups to join
PatchCanvas::setGroupPos(30, 1118, 591, 0, 0)
PatchCanvas::setGroupPos(30, 1118, 591, 0, 0) - unable to find group to reposition
PatchCanvas::addGroup(30, b'Audio to CV', SPLIT_UNDEF, ICON_PLUGIN)
...

If this happens, the canvas box will be placed in the default position,
rather than obeying the PatchbayClientPositionChanged signal. This PR
keeps track of missed events and then applies them once the object is
actually added.

Fixes (some cases of) plugins ignoring saved `(x, y)` coordinates when a
project is loaded. The canvas can get notified of a plugin's position
before the plugin is actually added, so when the plugin is actually it
just goes to the default position.

This happens because `PatchbayClientPositionChanged` events can arrive
before `PatchbayClientAdded` events, as seen in debug logs like this:

```
...
PatchCanvas::joinGroup(30)
PatchCanvas::joinGroup(30) - unable to find groups to join
PatchCanvas::setGroupPos(30, 1118, 591, 0, 0)
PatchCanvas::setGroupPos(30, 1118, 591, 0, 0) - unable to find group to reposition
PatchCanvas::addGroup(30, b'Audio to CV', SPLIT_UNDEF, ICON_PLUGIN)
...
```

If this happens, the canvas box will be placed in the default position,
rather than obeying the `PatchbayClientPositionChanged` signal. This PR
keeps track of missed events and then applies them once the object is
actually added.
@StefansM

Copy link
Copy Markdown
Contributor Author

I'm sure that there is a better way to do this, but some quick googling suggests that QT doesn't guarantee the order in which slots get called, so state will need to be aggregated somewhere.

@falkTX

falkTX commented Jan 2, 2022

Copy link
Copy Markdown
Owner

is this happening using pipewire or jack?

@StefansM

Copy link
Copy Markdown
Contributor Author

Apologies for the slow response. I've only observed this using Jack. I've not tried with any other backends though, so I can't draw any conclusions from that.

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