From b97e42dcaa0c5c7d9d31ac0aab23369cc88adae5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 14 Aug 2020 12:04:03 +0200 Subject: [PATCH] LibGUI: Make ModelSelection non-copyable and non-movable These are meant to be attached to an AbstractView at all times. --- Applications/FileManager/main.cpp | 2 +- Libraries/LibGUI/ModelSelection.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index ea2be2f849..9c6eb39742 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -775,7 +775,7 @@ int run_in_windowed_mode(RefPtr config, String initial_locatio directory_view.on_selection_change = [&](GUI::AbstractView& view) { // FIXME: Figure out how we can enable/disable the paste action, based on clipboard contents. - auto selection = view.selection(); + auto& selection = view.selection(); delete_action->set_enabled(!selection.is_empty() && access(directory_view.path().characters(), W_OK) == 0); copy_action->set_enabled(!selection.is_empty()); diff --git a/Libraries/LibGUI/ModelSelection.h b/Libraries/LibGUI/ModelSelection.h index 1581126e3c..f31e08ae99 100644 --- a/Libraries/LibGUI/ModelSelection.h +++ b/Libraries/LibGUI/ModelSelection.h @@ -31,10 +31,14 @@ #include #include #include +#include namespace GUI { class ModelSelection { + AK_MAKE_NONCOPYABLE(ModelSelection); + AK_MAKE_NONMOVABLE(ModelSelection); + public: ModelSelection(AbstractView& view) : m_view(view)