~alan-griffiths/mir/fix-1718677

« back to all changes in this revision

Viewing changes to src/server/frontend/wayland/wayland_connector.cpp

  • Committer: Alan Griffiths
  • Date: 2017-09-21 15:52:57 UTC
  • Revision ID: alan@octopull.co.uk-20170921155257-gv8zdsz0mp2y0vmn
Don't leak WlShellSurface instances

Show diffs side-by-side

added added

removed removed

Lines of Context:
1409
1409
                shell->modify_surface(session, id, hide_spec);
1410
1410
            });
1411
1411
 
1412
 
        auto shim = new DestructionShim{session, shell, surface_id};
 
1412
        auto shim = new DestructionShim{session, shell, surface_id, this};
1413
1413
        shim->destruction_listener.notify = &cleanup_surface;
1414
1414
        wl_resource_add_destroy_listener(
1415
1415
            resource,
1476
1476
        DestructionShim(
1477
1477
            std::shared_ptr<mf::Session> const& session,
1478
1478
            std::shared_ptr<mf::Shell> const& shell,
1479
 
            mf::SurfaceId id)
 
1479
            mf::SurfaceId id,
 
1480
            WlShellSurface* self)
1480
1481
            : session{session},
1481
1482
              shell{shell},
1482
 
              surface_id{id}
 
1483
              surface_id{id},
 
1484
              self{self}
1483
1485
        {
1484
1486
        }
1485
1487
 
1487
1489
        std::shared_ptr<mf::Shell> const shell;
1488
1490
        mf::SurfaceId const surface_id;
1489
1491
        wl_listener destruction_listener;
 
1492
        std::unique_ptr<WlShellSurface> const self;
1490
1493
    };
1491
1494
 
1492
1495
    static_assert(