Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3846b041 authored by Qasim Javed's avatar Qasim Javed
Browse files

rusty-gd: Use a sequenced runner to post closures.

With this, I am able to reconnect to Pixel Buds successfully.

Previously, there was a crash due CHECK(ThreadTaskRunner::IsSet())
failing.

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost DirectHciTest

Change-Id: I43ad40b03a63bdec5284c584216671bd3ae20376
parent 5f6bda0c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
#pragma once

#include "base/callback.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "rust/cxx.h"

namespace bluetooth {
@@ -53,7 +54,8 @@ class OnceClosure {
  }

  void Run() const {
    std::move(*closure_).Run();
    base::SequencedTaskRunnerHandle::Get()->PostTask(
        FROM_HERE, std::move(*closure_));
    delete closure_;
    ((OnceClosure*)this)->closure_ = nullptr;
  }