 +      finalize = display_stream_wrappers_.empty();
 +    }
 +    if (finalize) {
-       delete this;
++      delete this;
 +    }
    }
  

diff --git a/modules/desktop_capture/screen_capturer_mac.mm b/modules/desktop_capture/screen_capturer_mac.mm
index 6f2690f28..7d297f56e 100644
--- a/modules/desktop_capture/screen_capturer_mac.mm
+++ b/modules/desktop_capture/screen_capturer_mac.mm
@@ -36,6 +36,7 @@
 #include "rtc_base/macutils.h"
 #include "rtc_base/timeutils.h"
 #include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h"
+#include "system_wrappers/include/rw_lock_wrapper.h"
 
 namespace webrtc {
 
@@ -48,20 +49,32 @@ namespace {
 // destroy itself once it's done.
 class DisplayStreamManager {
  public:

     for (auto& pair : display_stream_wrappers_) {
       DisplayStreamWrapper& wrapper = pair.second;
       if (wrapper.active) {
@@ -61,12 +76,23 @@ class DisplayStreamManager {
   void PrepareForSelfDestruction() {
     ready_for_self_destruction_ = true;
 
-    if (display_stream_wrappers_.empty()) delete this;
+    bool finalize;
+    {
+      WriteLockScoped scoped_display_stream_manager_lock(*rw_lock_);
