Syncing task from Mir.

** Changed in: mir (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to mir in Ubuntu.
https://bugs.launchpad.net/bugs/1630801

Title:
  Potentially unsafe iteration in SurfaceStack (if used wrong)

Status in Mir:
  New
Status in mir package in Ubuntu:
  New

Bug description:
  RecursiveReadLocks don't exclude modification by the same thread.

  This means that code like:

  void 
ms::SurfaceStack::for_each(std::function<void(std::shared_ptr<mi::Surface> 
const&)> const& callback)
  {
      RecursiveReadLock lg(guard);
      for (auto &surface : surfaces)
      {
          if (surface->query(mir_surface_attrib_visibility) ==
              MirSurfaceVisibility::mir_surface_visibility_exposed)
          {
              callback(surface);
          }
      }
  }

  is unsafe; if the callback calls into SurfaceStack::add_surface or
  SurfaceStack::remove_surface it will happily take a RecursiveWriteLock
  and mutate the surfaces vector, possibly invalidating the iterators.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mir/+bug/1630801/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to