Skip to content

Commit

Permalink
fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rauch committed Sep 27, 2018
1 parent 0e29437 commit e6ef1ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/display/device/display_wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ struct WaylandDisplay {
int lasty=0;

std::vector<EGLConfig> egl_configs;
EGLSurface egl_surface;
EGLContext egl_context;
EGLDisplay egl_display;
EGLSurface egl_surface = nullptr;
EGLContext egl_context = nullptr;
EGLDisplay egl_display = nullptr;

EGLint width, height;
bool is_fullscreen;
Expand Down Expand Up @@ -824,6 +824,8 @@ WaylandDisplay::~WaylandDisplay() {
if(wsurface) wl_surface_destroy(wsurface);
if(wregistry) wl_registry_destroy(wregistry);
if(wdisplay) wl_display_disconnect(wdisplay);

if(xkb_context) xkb_context_unref(xkb_context);
}

WaylandWindow::WaylandWindow(const int w, const int h, std::unique_ptr<WaylandDisplay> display) : display(std::move(display)){
Expand Down
2 changes: 2 additions & 0 deletions src/display/device/display_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ X11Window::X11Window(
throw std::runtime_error("Pangolin X11: Failed to create window." );
}

XFree(vi);

XStoreName( display->display, win, title.c_str() );
XMapWindow( display->display, win );

Expand Down

0 comments on commit e6ef1ce

Please sign in to comment.