Commit d21096fa authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Fix adding files to data project

In cf01ff31 this broke by randomly using QSharedPointer in the wrong way.
There was only this one item being referenced, once it fell out of scope it got deleted, and then by the
time the event loop returned and the queued invocation was processed, the object was already gone.

Just use WA_DeleteOnClose which will clean up nicely once we're done.

BUG: 375016

Differential Revision: https://phabricator.kde.org/D4571
parent c01a9cbf
......@@ -50,7 +50,6 @@
#include <QtWidgets/QLabel>
#include <QtWidgets/QLayout>
#include <QtWidgets/QInputDialog>
#include <QSharedPointer>
#include <unistd.h>
......@@ -144,8 +143,9 @@ void K3b::DataUrlAddingDialog::addUrls( const QList<QUrl>& urls,
QWidget* parent )
{
if( !urls.isEmpty() ) {
QSharedPointer<DataUrlAddingDialog> dlgPtr = QSharedPointer<DataUrlAddingDialog>(new DataUrlAddingDialog( urls, dir, parent ));
QMetaObject::invokeMethod( dlgPtr.data(), "slotStartAddUrls", Qt::QueuedConnection );
auto *dlg = new DataUrlAddingDialog( urls, dir, parent );
dlg->setAttribute(Qt::WA_DeleteOnClose);
QMetaObject::invokeMethod( dlg, "slotStartAddUrls", Qt::QueuedConnection );
}
}
......@@ -155,8 +155,9 @@ void K3b::DataUrlAddingDialog::moveItems( const QList<K3b::DataItem*>& items,
QWidget* parent )
{
if( !items.isEmpty() ) {
QSharedPointer<DataUrlAddingDialog> dlgPtr = QSharedPointer<DataUrlAddingDialog>(new DataUrlAddingDialog( items, dir, false, parent ));
QMetaObject::invokeMethod( dlgPtr.data(), "slotStartCopyMoveItems", Qt::QueuedConnection );
auto *dlg = new DataUrlAddingDialog( items, dir, false, parent );
dlg->setAttribute(Qt::WA_DeleteOnClose);
QMetaObject::invokeMethod( dlg, "slotStartCopyMoveItems", Qt::QueuedConnection );
}
}
......@@ -166,8 +167,9 @@ void K3b::DataUrlAddingDialog::copyItems( const QList<K3b::DataItem*>& items,
QWidget* parent )
{
if( !items.isEmpty() ) {
QSharedPointer<DataUrlAddingDialog> dlgPtr = QSharedPointer<DataUrlAddingDialog>(new DataUrlAddingDialog( items, dir, true, parent ));
QMetaObject::invokeMethod( dlgPtr.data(), "slotStartCopyMoveItems", Qt::QueuedConnection );
auto *dlg = new DataUrlAddingDialog( items, dir, true, parent );
dlg->setAttribute(Qt::WA_DeleteOnClose);
QMetaObject::invokeMethod( dlg, "slotStartCopyMoveItems", Qt::QueuedConnection );
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment