From 3dd4433645125723c5f3f874d3ff252b0a0cef5d Mon Sep 17 00:00:00 2001 From: kateleet Date: Tue, 21 Dec 2021 22:35:56 +0800 Subject: [PATCH] fix: crash when switching view --- helper/shortcut.cpp | 9 +++++---- qml/FolderGridView.qml | 2 ++ qml/FolderListView.qml | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/helper/shortcut.cpp b/helper/shortcut.cpp index 5edaf79..1ef47a7 100644 --- a/helper/shortcut.cpp +++ b/helper/shortcut.cpp @@ -32,13 +32,14 @@ ShortCut::ShortCut(QObject *parent) void ShortCut::install(QObject *target) { - if (m_object) { - m_object->removeEventFilter(this); - } + // No need to remove, because memory space is automatically freed in qml. + // if (m_object) { + // m_object->removeEventFilter(this); + // } if (target) { target->installEventFilter(this); - m_object = target; + // m_object = target; } } diff --git a/qml/FolderGridView.qml b/qml/FolderGridView.qml index 0482aa2..1c09e8b 100644 --- a/qml/FolderGridView.qml +++ b/qml/FolderGridView.qml @@ -27,6 +27,8 @@ import FishUI 1.0 as FishUI GridView { id: control + objectName: "FolderGridView" + property bool isDesktopView: false property Item rubberBand: null diff --git a/qml/FolderListView.qml b/qml/FolderListView.qml index 9903f85..283880f 100644 --- a/qml/FolderListView.qml +++ b/qml/FolderListView.qml @@ -26,6 +26,8 @@ import Cutefish.DragDrop 1.0 as DragDrop ListView { id: control + objectName: "FolderListView" + property Item rubberBand: null property Item hoveredItem: null property Item pressedItem: null