Bug 1718499 [Linux] Release wl_registry right after we use it, r=rmader

Differential Revision: https://phabricator.services.mozilla.com/D118907
This commit is contained in:
stransky 2021-06-28 11:27:27 +00:00
Родитель ca0a51ea08
Коммит 788d06bdbc
2 изменённых файлов: 4 добавлений и 14 удалений

Просмотреть файл

@ -170,25 +170,18 @@ static const struct wl_registry_listener registry_listener = {
global_registry_handler, global_registry_remover};
nsDMABufDevice::nsDMABufDevice()
: mRegistry(nullptr),
mXRGBFormat({true, false, GBM_FORMAT_XRGB8888, nullptr, 0}),
: mXRGBFormat({true, false, GBM_FORMAT_XRGB8888, nullptr, 0}),
mARGBFormat({true, true, GBM_FORMAT_ARGB8888, nullptr, 0}),
mGbmDevice(nullptr),
mGbmFd(-1),
mInitialized(false) {
if (GdkIsWaylandDisplay()) {
wl_display* display = WaylandDisplayGetWLDisplay();
mRegistry = (void*)wl_display_get_registry(display);
wl_registry_add_listener((wl_registry*)mRegistry, &registry_listener, this);
wl_registry* registry = wl_display_get_registry(display);
wl_registry_add_listener(registry, &registry_listener, this);
wl_display_roundtrip(display);
wl_display_roundtrip(display);
}
}
nsDMABufDevice::~nsDMABufDevice() {
if (mRegistry) {
wl_registry_destroy((wl_registry*)mRegistry);
mRegistry = nullptr;
wl_registry_destroy(registry);
}
}

Просмотреть файл

@ -162,7 +162,6 @@ struct GbmFormat {
class nsDMABufDevice {
public:
nsDMABufDevice();
~nsDMABufDevice();
gbm_device* GetGbmDevice();
// Returns -1 if we fails to gbm device file descriptor.
@ -187,8 +186,6 @@ class nsDMABufDevice {
private:
bool IsDMABufEnabled();
void* mRegistry;
GbmFormat mXRGBFormat;
GbmFormat mARGBFormat;