Chromium Code Reviews| Index: base/supports_user_data.cc |
| diff --git a/base/supports_user_data.cc b/base/supports_user_data.cc |
| index 2a0263ed0d1881e6552f04b44a34fadf3e441cb2..8c6bf9116a13fb54536367bcee489bf77d393600 100644 |
| --- a/base/supports_user_data.cc |
| +++ b/base/supports_user_data.cc |
| @@ -35,6 +35,11 @@ void SupportsUserData::DetachUserDataThread() { |
| SupportsUserData::~SupportsUserData() { |
| DCHECK(thread_checker_.CalledOnValidThread() || user_data_.empty()); |
| + DataMap local_user_data; |
| + user_data_.swap(local_user_data); |
| + // Now this->user_data_ is empty, and any destructors called transitively from |
| + // the destruction of |local_user_data| will see it that way instead of |
| + // calling into a being-destroyed object. |
|
Peter Kasting
2014/05/28 03:44:13
Nit: calling into -> examining
Jeffrey Yasskin
2014/05/28 05:45:26
Done.
|
| } |
| } // namespace base |