-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/118269/
-----------------------------------------------------------

Review request for KDE Frameworks and David Faure.


Bugs: 334648
    https://bugs.kde.org/show_bug.cgi?id=334648


Repository: kjobwidgets


Description
-------

Currently Dolphin (and probably anything else that can delete files using KIO) 
crashes when it's supposed to show the confirmation dialog.

The problem is that KonqOperations::askDeleteConfirmation() sets up a 
KIO::JobUiDelegate object which has no associated job, and calls its 
setWindow(QWidget*) method before calling the actual askDeleteConfirmation() 
function.

KIO::JobUiDelegate::setWindow(QWidget*) then calls the setWindow function of 
the base class, KDialogJobUiDelegate::setWindow(QWidget*), which then crashes 
because it contains the line

Q_ASSERT(job())

and there is no job.

The problem does not exist in KDE SC 4.x - the code went through a big 
refactoring in

https://git.reviewboard.kde.org/r/111081/

which added the assert.

Just removing the assert won't help because the function then calls
KJobWidgets::setWindow(KJob *job, QWidget *widget)
which dereferences the job, i.e., we get a segfault instead.

This patch removes the assert and wraps the function in an "if (job())" block 
instead. I'm not entirely sure if that is the correct solution though - any 
feedback is welcome. Alternatively, one could move the if-check to the child 
class, i.e., to KIO::JobUiDelegate::setWindow(QWidget*), if this is the only 
valid use of a KDialogJobUiDelegate without a job.

Or maybe it does not make much sense at all to have the askDeleteConfirmation 
function, which is probably always called before any job is set up, in a 
KDialogJobUiDelegate subclass? Changing that would probably require more 
intrusive changes though.


Diffs
-----

  src/kdialogjobuidelegate.cpp fb4c99a 

Diff: https://git.reviewboard.kde.org/r/118269/diff/


Testing
-------

Fixes the crash for me, and the confirmation dialog works as expected (i.e., 
the user can choose if the file should really be deleted/trashed or not).


Thanks,

Frank Reininghaus

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to