blob: e6e973dbd9808b7e523a6cfeee3d2c60774076a1 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#include "rtc_base/message_handler.h"
Jonas Olssona4d87372019-07-05 19:08:33 +020012
Sebastian Jansson6ea2c6a2020-01-13 14:07:22 +010013#include "rtc_base/thread.h"
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000014
15namespace rtc {
16
Tomas Gunnarsson77baeee2020-09-24 22:39:21 +020017MessageHandlerAutoCleanup::MessageHandlerAutoCleanup() {}
Tomas Gunnarsson12359412020-09-11 23:48:54 +020018
19MessageHandlerAutoCleanup::~MessageHandlerAutoCleanup() {
20 // Note that even though this clears currently pending messages for the
21 // message handler, it's still racy since it doesn't prevent threads that
22 // might be in the process of posting new messages with would-be dangling
23 // pointers.
24 // This is related to the design of Message having a raw pointer.
25 // We could consider whether it would be safer to require message handlers
26 // to be reference counted (as some are).
27 ThreadManager::Clear(this);
28}
Tomas Gunnarssonabdb4702020-09-05 18:43:36 +020029
Yves Gerey665174f2018-06-19 15:03:05 +020030} // namespace rtc