Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Memory Leak fix. #21

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions desktop_screen_wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ gfx::Size GetPrimaryDisplaySize() {
}
} // namespace

namespace ui {
DesktopScreenWayland::DesktopScreenWayland() {
}

Expand Down Expand Up @@ -70,3 +71,5 @@ void DesktopScreenWayland::AddObserver(gfx::DisplayObserver* observer) {

void DesktopScreenWayland::RemoveObserver(gfx::DisplayObserver* observer) {
}

}
2 changes: 2 additions & 0 deletions desktop_screen_wayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "ui/gfx/screen.h"

namespace ui {
class DesktopScreenWayland : public gfx::Screen {
public:
DesktopScreenWayland();
Expand All @@ -30,5 +31,6 @@ class DesktopScreenWayland : public gfx::Screen {

DISALLOW_COPY_AND_ASSIGN(DesktopScreenWayland);
};
}

#endif // DESKTOP_SCREEN_WAYLAND_H__
13 changes: 11 additions & 2 deletions surface_factory_wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ void SurfaceFactoryWayland::InitializeWaylandEvent()
}

SurfaceFactoryWayland::SurfaceFactoryWayland()
: e_factory(NULL),
: desktop_screen_(NULL),
e_factory(NULL),
root_window_(NULL),
spec_(NULL)
{
Expand All @@ -109,6 +110,11 @@ void SurfaceFactoryWayland::ShutdownHardware() {
root_window_ =NULL;
}

if (desktop_screen_) {
delete desktop_screen_;
desktop_screen_ = NULL;
}

WaylandDisplay::DestroyDisplay();
}

Expand Down Expand Up @@ -147,7 +153,10 @@ const char* SurfaceFactoryWayland::DefaultDisplaySpec() {
}

gfx::Screen* SurfaceFactoryWayland::CreateDesktopScreen() {
return new DesktopScreenWayland;
if (!desktop_screen_)
desktop_screen_ = new DesktopScreenWayland();

return (gfx::Screen*)desktop_screen_;
}

bool SurfaceFactoryWayland::LoadEGLGLES2Bindings() {
Expand Down
2 changes: 2 additions & 0 deletions surface_factory_wayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace ui {

class WaylandDisplay;
class WaylandWindow;
class DesktopScreenWayland;
class EventFactoryWayland;

class SurfaceFactoryWayland : public SurfaceFactoryOzone {
Expand All @@ -35,6 +36,7 @@ class SurfaceFactoryWayland : public SurfaceFactoryOzone {
private:
void InitializeWaylandEvent();

DesktopScreenWayland* desktop_screen_;
EventFactoryWayland* e_factory;
WaylandWindow* root_window_;
char* spec_;
Expand Down