#5487 closed Bug (fixed)
Qt client crash when using "Open URL" action
Reported by: | mike.dld | Owned by: | jordan |
---|---|---|---|
Priority: | Normal | Milestone: | 2.83 |
Component: | Qt Client | Version: | 2.82 |
Severity: | Normal | Keywords: | backport-2.8x patch |
Cc: |
Description
Steps to reproduce:
- activate "Open..." from main menu, toolbar or using Ctrl+O hotkey
- cancel the dialog
- activate "Open URL..." from main menu, toolbar or using Ctrl+U hotkey
Result: application crashes inside TrMainWindow::addTorrent on access to myFileDialogOptionsCheck, where checkbox has already been destroyed while the pointer is not reset to NULL.
Attached is a possible [minimalistic] fix using QWeakPointer to track checkbox destruction. Note that it omits check for Prefs::OPTIONS_PROMPT as "Open URL" presumably should always result in dialog being shown (tell me if I'm wrong).
Attachments (3)
Change History (9)
Changed 9 years ago by mike.dld
comment:1 Changed 9 years ago by jordan
Changed 9 years ago by jordan
comment:2 Changed 9 years ago by jordan
- Milestone changed from None Set to 2.83
- Status changed from new to assigned
comment:3 Changed 9 years ago by mike.dld
I didn't notice the possibility to open several file dialogs at once, this surely makes situation even worse.
I generally agree with your patch (even though the code usually "smells" when someone uses sender()), but would consider moving options showing logic to TrMainWindow::addTorrents, which would allow to only determine whether to show options or not once.
Changed 9 years ago by mike.dld
comment:4 Changed 9 years ago by jordan
Yeah, that is better. That way the number of hops from slot to the sender() call is shorter. Also I like the way you made addTorrents() private.
comment:5 Changed 9 years ago by jordan
- Resolution set to fixed
- Status changed from assigned to closed
comment:6 Changed 9 years ago by jordan
- Keywords backport-2.8x added
Mike, good catch.
So, two issues here.
One approach would be to get rid of the private pointer altogether, and look up the QCheckBox in AddTorrent?() iff caller() is a QFileDialog.