Fix a crash when opening the transfer history dialog
ClosedPublic

Authored by wbauer on Nov 8 2017, 7:15 PM.

Details

Summary

I have no idea why it crashes in the first place, but this fixes the crash and the dialog looks at it should.

Test Plan

called "Transfer History" in the "File" menu, it shows the dialog now, before it crashed.

Diff Detail

Repository
R433 KGet
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
wbauer created this revision.Nov 8 2017, 7:15 PM
wbauer added a comment.Nov 8 2017, 7:17 PM

The main reason I put this up on phabricator is that I'm not sure about the real problem.
Maybe someone has an idea?

anthonyfieroni added inline comments.
ui/history/transferhistory.cpp
93

layout() returns nullptr, it should be setted before use, as in patch.

wbauer added inline comments.Nov 8 2017, 7:45 PM
ui/history/transferhistory.cpp
93

That was my suspicion as well.
So do you think the patch is the correct fix, or should I change something else?

anthonyfieroni added inline comments.Nov 9 2017, 5:07 AM
ui/history/transferhistory.cpp
55

About me this should be in class scope, now at end of constructor Ui::TransferHistory desctructior is called.

wbauer added inline comments.Nov 9 2017, 1:18 PM
ui/history/transferhistory.cpp
55

Ok.
That doesn't cause the crash though. And it still crashes if I make widget a class member instead.

anthonyfieroni added inline comments.Nov 9 2017, 2:08 PM
ui/history/transferhistory.cpp
55

Let's see the backtrace, it does not look correct.

wbauer added inline comments.Nov 9 2017, 2:42 PM
ui/history/transferhistory.cpp
55

Here you are:
https://paste.kde.org/p2raxulvp
(I probably should have provided it right away, sorry)

That's with the original code (without the proposed fix here of course), with "widget" moved to the class, i.e. this patch:
https://build.opensuse.org/package/view_file/home:wolfi323:branches:KDE:Unstable:Applications/kget/fix-transferhistory-crash.patch?expand=1

I didn't install Qt debug packages though, I can if it helps of course.

TBH, I'd prefer to commit this for now, to have the crash fixed in the 17.12 beta.

Thank you very much for D8741, but as I mentioned there it causes a regression regarding the dialog size and I don't think it's good to push now without fixing that...
Let's target that for 18.04, I'll try to investigate myself when I have more time.

Do you agree?

Can you provide steps for reproduce?

Can you provide steps for reproduce?

Reproduce what?
The crash, or the too small dialog with D8741?

The steps to reproduce are the same though:
Select "Transfer History" in the "File" menu.

With this patch here, the dialog opens with a sane size, and remembers the size if you open it again (or run kget again).
With D8741 the height is (much) too small, and if you resize it it still will open too small the next time.

Without either patch, kget crashes.

I understand it goes to smaller :) Ok i'll make it to store geometry in rc file.

I understand it goes to smaller :) Ok i'll make it to store geometry in rc file.

Well, I think it did store it, because when I switched back to this patch afterwards the dialog was still too small. ;-)
Resizing helped then though, or deleting kgetrc.

I understand it goes to smaller :) Ok i'll make it to store geometry in rc file.

Well, I think it did store it, because when I switched back to this patch afterwards the dialog was still too small. ;-)
Resizing helped then though, or deleting kgetrc.

PS, to be clear: the main issue I have with D8741 is not that it doesn't store the size, but that it opens much too small in the first place.

This revision was automatically updated to reflect the committed changes.

I decided to push this now as a temporary fix for the crash.

I definitely want to follow up on D8741 though.
Thank you for your input and contribution so far! I really appreciate it.