Stopping a MIDI record cuts off part of the end

I’m recording MIDI tracks. They are properly recorded, however, when I hit the stop button, the end of the region gets kind of dragged 3/4 of a measure to the left. So when playing it, it stops 3 quarters too early.
However, the data is properly recorded, all I have to do is to drag it again to its full recording.

I am on Ardour 8.6 official ardour.org download, Fedora 40. Using ALSA for Ardour.

Can someone else observe something similar?
Regards,
Robert

If there are tempo changes in the session, then this is likely a bug that I fixed this week.

Yes, indeed, there is one tempo change from 110 to 120 at bar 21 of 96.

Yeah, probably the bug I fixed last week. You can test it out via nightly.ardour.org (which can be paralleled installed with any other version of Ardour that you have).