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

Wrong buffer size in DefaultDisplaySpec #6

Closed
wants to merge 3 commits 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
18 changes: 13 additions & 5 deletions surface_factory_wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ void SurfaceFactoryWayland::InitializeWaylandEvent()

SurfaceFactoryWayland::SurfaceFactoryWayland()
: e_factory(NULL),
display_(ui::WaylandDisplay::GetDisplay()) {
display_(ui::WaylandDisplay::GetDisplay()),
spec_(0){
LOG(INFO) << "Ozone: SurfaceFactoryWayland";
}

SurfaceFactoryWayland::~SurfaceFactoryWayland() {
SurfaceFactoryWayland::~SurfaceFactoryWayland()
{
if (spec_)
delete spec_;
}

intptr_t SurfaceFactoryWayland::InitializeHardware()
Expand Down Expand Up @@ -120,13 +124,17 @@ gfx::AcceleratedWidget SurfaceFactoryWayland::RealizeAcceleratedWidget(
}

const char* SurfaceFactoryWayland::DefaultDisplaySpec() {
// (kalyan) We could track active mode of front screen
// instead of having to go through the modes on every call.
std::list<ui::WaylandScreen*> screens = display_->GetScreenList();
gfx::Rect scrn = screens.front()->GetAllocation();
char *str = new char[12];
int size = 2 * sizeof scrn.width();
if (!spec_)
spec_ = new char[size];

base::snprintf(str, sizeof(str), "%dx%d", scrn.width(), scrn.height());
base::snprintf(spec_, size, "%dx%d", scrn.width(), scrn.height());

return str;
return spec_;
}

gfx::Screen* SurfaceFactoryWayland::CreateDesktopScreen() {
Expand Down
1 change: 1 addition & 0 deletions surface_factory_wayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class SurfaceFactoryWayland : public SurfaceFactoryOzone {

ui::EventFactoryWayland *e_factory;
ui::WaylandDisplay* display_;
char* spec_;
};

} // namespace ui
Expand Down