mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 13:47:05 +02:00
Do not destroy drag after launchDrag()
On X11 we need to keep the QDrag around a little longer. Right now, drag is scoped local to launchDrag() and will be destroyed immediately when launchDrag() finishes. However for X11 we must keep the drag object alive a little longer. It may only be destroyed once the drag operation has been accepted by another window, otherwise drag and drop is broken on Linux and no action happens when something is dragged from Telegram into another window. This is because there is still communication happening in the XDND protocol once QDrag::exec() finishes. See the documentation for reference: https://freedesktop.org/wiki/Specifications/XDND/ Fixes #17291
This commit is contained in:
parent
b341dddbb9
commit
c2b2d0a92a
1 changed files with 3 additions and 1 deletions
|
@ -964,7 +964,9 @@ int MainWindow::tryToExtendWidthBy(int addToWidth) {
|
|||
void MainWindow::launchDrag(
|
||||
std::unique_ptr<QMimeData> data,
|
||||
Fn<void()> &&callback) {
|
||||
auto drag = std::make_unique<QDrag>(this);
|
||||
// Qt destroys this QDrag automatically after the drag is finished
|
||||
// We must not delete this at the end of this function, as this breaks DnD on Linux
|
||||
auto drag = new QDrag(this);
|
||||
drag->setMimeData(data.release());
|
||||
drag->exec(Qt::CopyAction);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue