Repository navigation
Keep drag-picture grabs alive when delegates disappear - #196
Conversation
[Medium impact] The latest changes appear safe to merge. SummaryThe PR keeps pending drag pictures alive when rows or tiles disappear. The latest update adds the missing test for removing an item while its window stays open.
Reviews (2) · Last reviewed commit: "Test pending grabs when a delegate disap..." · Reviewed by Greptile |
| QVERIFY(picture->capture(source)); | ||
| if (i % 2 == 0) { | ||
| delete source; | ||
| // A rendered frame is the boundary for the pending grab. | ||
| QSignalSpy frame(window, &QQuickWindow::frameSwapped); | ||
| window->update(); | ||
| QTRY_VERIFY(!frame.isEmpty()); | ||
| QCOMPARE(ready.count(), 0); |
There was a problem hiding this comment.
Delegate destruction goes untested. The source-deletion branch leaves
picture alive, so its m_grab still holds the pending capture. The other branch deletes the whole window. Neither covers scrolling a delegate away, where both the source and DragPicture disappear while the window keeps rendering—the case that needs the new window-held reference.
Add a branch that deletes both objects after capture(), leaves the window open, and waits for another frame. This would cover the ownership path this fix adds.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Thanks, added the missing case. The test now starts a grab, destroys the delegate containing both the source and DragPicture, and waits for another frame with the window still open. It checks that both objects were destroyed and no ready signal was delivered. The source-only and window-close cases remain covered.
Passed at scales 1 and 2 and on native Wayland. The full suite passed: 253 passed, 0 failed, 1 environmental skip.
The list made a new row for every file scrolled in and threw away every row scrolled out. Turning on reuseItems gives the rows scrolled out to the files scrolled in instead; scrolling 3,000 files through the list offscreen took 1.5 s of layout before and 0.16 s after. Nearly everything a row shows is bound to its file's roles, so follows the file it's given. What isn't is the picture taken for dragging it: a row given another file under a still pointer stays hovered, so takes no new one, and a drag from there showed the file before. A reused row now drops that picture and, still hovered, takes a new one. The rest of the pilot's guards are dropped: the pooled state gating every handler, the Loader around the tap handler, the arrow's pressed path, the drag generations and holding reuse off during a drag. They cover a mouse button held through a page of scrolling, a double-click split by a jump that moves the cursor, or a scroll during a drag the system holds; and the drag picture's superseded grabs are already ignored by DragPicture since omacom#196. The tests go down to one for the picture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Pilot tree-list row reuse for rendered-frame measurements * Cancel a tree arrow press when its row is pooled * Cover reused tree rows, thumbnails and pointer lifecycles in the main test suite * Check thumbnail pixels at display scale and assert reused tree arrows * Keep only the reset a reused row needs The list made a new row for every file scrolled in and threw away every row scrolled out. Turning on reuseItems gives the rows scrolled out to the files scrolled in instead; scrolling 3,000 files through the list offscreen took 1.5 s of layout before and 0.16 s after. Nearly everything a row shows is bound to its file's roles, so follows the file it's given. What isn't is the picture taken for dragging it: a row given another file under a still pointer stays hovered, so takes no new one, and a drag from there showed the file before. A reused row now drops that picture and, still hovered, takes a new one. The rest of the pilot's guards are dropped: the pooled state gating every handler, the Loader around the tap handler, the arrow's pressed path, the drag generations and holding reuse off during a drag. They cover a mouse button held through a page of scrolling, a double-click split by a jump that moves the cursor, or a scroll during a drag the system holds; and the drag picture's superseded grabs are already ignored by DragPicture since #196. The tests go down to one for the picture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Kirill Kostin <15322854+k-kostin@users.noreply.github.com> Co-authored-by: David Heinemeier Hansson <david@hey.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Rapid PageDown/PageUp scrolling with the pointer over a row can crash Folio while Qt is preparing its drag picture. Reproduced on unmodified main at
905999e, without #122 applied.A small public-Qt helper preserves the existing hover-generated pictures in lists, columns and the grid. Superseded requests can finish safely; discarded delegates receive no reply. No new dependencies.
Related to #122 because both touch the row's drag-picture handling. This PR is based directly on main and can be reviewed independently. If #122 lands first, I'll adapt this fix to it and rerun the relevant checks.
Evidence
QQuickItemGrabResult::render().After: Six fresh processes completed all 2,160 keypresses and closed normally; an additional process completed 1,080 keypresses and closed normally.
bin/test -V: 253 passed, 0 failed, 1 environmental skip (root-drive trash requires writable/without.Trash).Merge Danger
Door: Two-way — code-only change, no data migration.
Blast Radius: Drag pictures — shared by list, column and grid delegates.