|
Opening selection mode twice with a single folder selected causes
a crash. SetFolderIconItemAction expects its widget to be
destroyed but the SelectionMode::BottomBar code path keeps it
alive, so the second call to QWidgetAction::createWidget() of the
folder icon chooser crashes because the previously created widget
still has a parent. This small check fixes the crash.
Contrarily, the regular context menu does destroy the actions on
hide, so no crash happens there. An alternative fix to what was
implemented in this commit could look at the lifetime handling of
the SelectionMode::BottomBar implementation. Its
BottomBarContentsContainer is never destroyed,
BottomBarContentsContainer::contextActionsFor does not set
lifetimes on contextActions, or destroys its actions on hide.
However, fixing this here in QWidgetAction::createWidget() also
makes sense because the related QWidgetAction::requestWidget()
method transfers ownership to the caller. It's not part of this
API to expect the caller to delete the widget immediately. On the
contrary QWidgetAction::requestWidget(QWidget *parent) is
typically expected to be callable e.g. by toolbars as well where
the action will persist indefinitely.
BUG: 508648
|