summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/EventLoop.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-06-08 19:36:27 +0430
committerAndreas Kling <kling@serenityos.org>2021-06-08 19:14:24 +0200
commit7ac196974de3a85430f4ccd1db883943853d8ae0 (patch)
treeefc838bfc282a16379e1c80b7f3e721a6eb8b297 /Userland/Libraries/LibCore/EventLoop.cpp
parent3d94b5051d8a783858cde04eb4d2e1ecf63ac180 (diff)
downloadserenity-7ac196974de3a85430f4ccd1db883943853d8ae0.zip
Everywhere: Replace Vector<T*> with nonnull entries with Vector<T&>
Diffstat (limited to 'Userland/Libraries/LibCore/EventLoop.cpp')
-rw-r--r--Userland/Libraries/LibCore/EventLoop.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp
index 23dabfc764..5fee393e47 100644
--- a/Userland/Libraries/LibCore/EventLoop.cpp
+++ b/Userland/Libraries/LibCore/EventLoop.cpp
@@ -58,7 +58,7 @@ struct EventLoop::Private {
};
static EventLoop* s_main_event_loop;
-static Vector<EventLoop*>* s_event_loop_stack;
+static Vector<EventLoop&>* s_event_loop_stack;
static NeverDestroyed<IDAllocator> s_id_allocator;
static HashMap<int, NonnullOwnPtr<EventLoopTimer>>* s_timers;
static HashTable<Notifier*>* s_notifiers;
@@ -257,7 +257,7 @@ EventLoop::EventLoop([[maybe_unused]] MakeInspectable make_inspectable)
: m_private(make<Private>())
{
if (!s_event_loop_stack) {
- s_event_loop_stack = new Vector<EventLoop*>;
+ s_event_loop_stack = new Vector<EventLoop&>;
s_timers = new HashMap<int, NonnullOwnPtr<EventLoopTimer>>;
s_notifiers = new HashTable<Notifier*>;
}
@@ -274,7 +274,7 @@ EventLoop::EventLoop([[maybe_unused]] MakeInspectable make_inspectable)
#endif
VERIFY(rc == 0);
- s_event_loop_stack->append(this);
+ s_event_loop_stack->append(*this);
#ifdef __serenity__
if (getuid() != 0
@@ -314,9 +314,7 @@ EventLoop& EventLoop::main()
EventLoop& EventLoop::current()
{
- EventLoop* event_loop = s_event_loop_stack->last();
- VERIFY(event_loop != nullptr);
- return *event_loop;
+ return s_event_loop_stack->last();
}
void EventLoop::quit(int code)
@@ -340,7 +338,7 @@ public:
{
if (&m_event_loop != s_main_event_loop) {
m_event_loop.take_pending_events_from(EventLoop::current());
- s_event_loop_stack->append(&event_loop);
+ s_event_loop_stack->append(event_loop);
}
}
~EventLoopPusher()