┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2023-04-19 00:10:54 +0200
committerFelix Ernst <[email protected]>2023-04-20 14:42:04 +0000
commit49ea43e24fede0dd001c594db9f35935facebba8 (patch)
tree8ef9433fafa985262423767fe5d778272278e963 /src
parentb99f6f50eef395a3ceb88fb3d4b7357cbbc13c85 (diff)
Reuse existing proxy style
Before this commit, a new QProxyStyle was created every time the selection mode was enabled. The previously used one was automatically deleted in the process because of the std::unique_ptr re-assignment. This isn't really a problem in itself, but I strongly assume that the sudden deletion of the old style shortly before setting a new style might be the cause of the crash/bug 468548. This commit simply re-uses the previously created proxy style which doesn't seem to cause any behaviour change even when the application style has been changed in the time since the proxy style was created. Another potential solution might be to simply use deleteLater() on the old proxy style instead of letting std::unique_ptr delete the old proxy style instantly while it is still in use. That seems more involved than simply re-using the old style though. BUG: 468548 FIXED-IN: 23.08
Diffstat (limited to 'src')
-rw-r--r--src/views/dolphinview.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 4ccb4a2e3..288b3ac5d 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -299,7 +299,9 @@ DolphinView::Mode DolphinView::viewMode() const
void DolphinView::setSelectionModeEnabled(const bool enabled)
{
if (enabled) {
- m_proxyStyle = std::make_unique<SelectionMode::SingleClickSelectionProxyStyle>();
+ if (!m_proxyStyle) {
+ m_proxyStyle = std::make_unique<SelectionMode::SingleClickSelectionProxyStyle>();
+ }
setStyle(m_proxyStyle.get());
m_view->setStyle(m_proxyStyle.get());
m_view->setEnabledSelectionToggles(DolphinItemListView::SelectionTogglesEnabled::False);