summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRummskartoffel <Rummskartoffel@protonmail.com>2022-01-15 15:23:40 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-15 21:45:03 +0100
commitada1d4906e016f7b55ffd0e8f74a78b55d6a4694 (patch)
treeee1af4c6412850d8eb3b993d81b5e07637af6fd3
parent5fe619de990f646e474a6e90a4f432075d5abb30 (diff)
downloadserenity-ada1d4906e016f7b55ffd0e8f74a78b55d6a4694.zip
Assistant: Make Provider ref-counted
-rw-r--r--Userland/Applications/Assistant/Providers.h2
-rw-r--r--Userland/Applications/Assistant/main.cpp12
2 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Applications/Assistant/Providers.h b/Userland/Applications/Assistant/Providers.h
index b50be49059..2469e912bc 100644
--- a/Userland/Applications/Assistant/Providers.h
+++ b/Userland/Applications/Assistant/Providers.h
@@ -128,7 +128,7 @@ private:
RefPtr<Gfx::Bitmap> m_bitmap;
};
-class Provider {
+class Provider : public RefCounted<Provider> {
public:
virtual ~Provider() = default;
diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp
index 522e65a444..f58df60e4d 100644
--- a/Userland/Applications/Assistant/main.cpp
+++ b/Userland/Applications/Assistant/main.cpp
@@ -122,11 +122,11 @@ public:
explicit Database(AppState& state)
: m_state(state)
{
- m_providers.append(make<AppProvider>());
- m_providers.append(make<CalculatorProvider>());
- m_providers.append(make<FileProvider>());
- m_providers.append(make<TerminalProvider>());
- m_providers.append(make<URLProvider>());
+ m_providers.append(make_ref_counted<AppProvider>());
+ m_providers.append(make_ref_counted<CalculatorProvider>());
+ m_providers.append(make_ref_counted<FileProvider>());
+ m_providers.append(make_ref_counted<TerminalProvider>());
+ m_providers.append(make_ref_counted<URLProvider>());
}
Function<void(NonnullRefPtrVector<Result>)> on_new_results;
@@ -176,7 +176,7 @@ private:
AppState& m_state;
- NonnullOwnPtrVector<Provider> m_providers;
+ NonnullRefPtrVector<Provider> m_providers;
Threading::Mutex m_mutex;
HashMap<String, NonnullRefPtrVector<Result>> m_result_cache;