Browse Source

CEventLoop: Use NonnullOwnPtr for QueuedEvent::event.

We don't allow null events in the event queue. :^)
Andreas Kling 6 năm trước cách đây
mục cha
commit
3c5befde36
2 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 1 1
      Libraries/LibCore/CEventLoop.cpp
  2. 2 2
      Libraries/LibCore/CEventLoop.h

+ 1 - 1
Libraries/LibCore/CEventLoop.cpp

@@ -148,7 +148,7 @@ void CEventLoop::pump(WaitMode mode)
     }
 }
 
-void CEventLoop::post_event(CObject& receiver, OwnPtr<CEvent>&& event)
+void CEventLoop::post_event(CObject& receiver, NonnullOwnPtr<CEvent>&& event)
 {
     LOCKER(m_lock);
 #ifdef CEVENTLOOP_DEBUG

+ 2 - 2
Libraries/LibCore/CEventLoop.h

@@ -30,7 +30,7 @@ public:
     // this should really only be used for integrating with other event loops
     void pump(WaitMode = WaitMode::WaitForEvents);
 
-    void post_event(CObject& receiver, OwnPtr<CEvent>&&);
+    void post_event(CObject& receiver, NonnullOwnPtr<CEvent>&&);
 
     static CEventLoop& main();
     static CEventLoop& current();
@@ -58,7 +58,7 @@ private:
 
     struct QueuedEvent {
         WeakPtr<CObject> receiver;
-        OwnPtr<CEvent> event;
+        NonnullOwnPtr<CEvent> event;
     };
 
     Vector<QueuedEvent, 64> m_queued_events;