Fix crash during download when the main window have been closed
ClosedPublic

Authored by chcuris on Aug 9 2018, 6:23 PM.

Details

Summary

Falkon has a feature to automatically close the tab that was specifically
opened for the file to download, because this kind of tab has no useful
purpose to the user.

In the case where the main window would have been closed, Falkon
would crash de-referencing the now NULL pointer to the main window.

This patch adds a simple check to do nothing in this case, as there is no
tab to close anyway.

Diff Detail

Repository
R875 Falkon
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
chcuris created this revision.Aug 9 2018, 6:23 PM
Restricted Application added a subscriber: falkon. · View Herald TranscriptAug 9 2018, 6:23 PM
chcuris requested review of this revision.Aug 9 2018, 6:23 PM
drosca requested changes to this revision.Aug 10 2018, 7:48 AM
drosca added a subscriber: drosca.

Why not just

if (mApp->getWindow() && testWebView(mApp->getWindow()->weView(), url)) {
...
}
This revision now requires changes to proceed.Aug 10 2018, 7:48 AM

Hello David,

I initially checked for mApp->getWindow() separately because when it is null there is no need to go any further, so it seemed simpler to me to directly stop instead of continuing (and couting on people looking at the code guessing that the rest of the code would do nothing in this case);

Furthermore I introduced the variable to query getWindow only once by habit because I prefer to explicit optimisations instead of counting on the compiler (and in this case the optimisation does not happen).

But as you are the project leader (and I thank you for the project), if you want the patch the way you proposed, just confirm me and you'll have it as fast as possible (no need to let that bug lie around).

drosca accepted this revision.Oct 4 2018, 7:51 AM

Alright,
I'll need your full name + email to commit it for you.

This revision is now accepted and ready to land.Oct 4 2018, 7:51 AM

Hello David,
I propose using Christophe CURIS <christophe.curis@free.fr>
Regards,
Christophe

This revision was automatically updated to reflect the committed changes.