summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 17:14:39 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 17:14:39 +0000
commitb5cdf10bef9fd68fe9b1d52c44113b50b7456f01 (patch)
tree1b3dab713b9618c7913ba5ced770f4e4664cd374
parente0cde4d967ddd9e75d55fbf466f57b4f05e1e07b (diff)
downloadchromium_src-b5cdf10bef9fd68fe9b1d52c44113b50b7456f01.zip
chromium_src-b5cdf10bef9fd68fe9b1d52c44113b50b7456f01.tar.gz
chromium_src-b5cdf10bef9fd68fe9b1d52c44113b50b7456f01.tar.bz2
Avoid posting tasks from a constructor of a ref-counted object because doing so might cause premature deletion of the object.
BUG=163559 Review URL: https://chromiumcodereview.appspot.com/11316267 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170468 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/host/event_executor_linux.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/remoting/host/event_executor_linux.cc b/remoting/host/event_executor_linux.cc
index b3176e3..9c0326e 100644
--- a/remoting/host/event_executor_linux.cc
+++ b/remoting/host/event_executor_linux.cc
@@ -164,15 +164,16 @@ EventExecutorLinux::Core::Core(
wheel_ticks_y_(0.0f),
display_(XOpenDisplay(NULL)),
root_window_(BadValue) {
-#if defined(REMOTING_HOST_LINUX_CLIPBOARD)
- if (!task_runner_->BelongsToCurrentThread())
- task_runner_->PostTask(FROM_HERE, base::Bind(&Core::InitClipboard, this));
-#endif // REMOTING_HOST_LINUX_CLIPBOARD
}
bool EventExecutorLinux::Core::Init() {
CHECK(display_);
+#if defined(REMOTING_HOST_LINUX_CLIPBOARD)
+ if (!task_runner_->BelongsToCurrentThread())
+ task_runner_->PostTask(FROM_HERE, base::Bind(&Core::InitClipboard, this));
+#endif // REMOTING_HOST_LINUX_CLIPBOARD
+
root_window_ = RootWindow(display_, DefaultScreen(display_));
if (root_window_ == BadValue) {
LOG(ERROR) << "Unable to get the root window";