From c765df18b41d8077c0b2a8b14d9f6e71109a05e8 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 11 Nov 2015 15:52:18 -0800 Subject: [PATCH] Do not delete the DrainJob within the DrainJob::Start callback DrainDataPipeInBackground posts a callback to DrainJob::Start, which constructs a DataPipeDrainer. The DataPipeDrainer's constructor may call OnDataComplete. If this happens, it is unsafe to delete the DrainJob while the callback is still running. --- sky/engine/platform/mojo/data_pipe.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sky/engine/platform/mojo/data_pipe.cc b/sky/engine/platform/mojo/data_pipe.cc index 099ca9490b8..bee21b0d76b 100644 --- a/sky/engine/platform/mojo/data_pipe.cc +++ b/sky/engine/platform/mojo/data_pipe.cc @@ -35,7 +35,7 @@ class DrainJob : public mojo::common::DataPipeDrainer::Client { void OnDataComplete() override { Platform::current()->GetUITaskRunner()->PostTask(FROM_HERE, base::Bind(callback_, buffer_.release())); - delete this; + base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); } base::Callback)> callback_;