From db9fb97ea824bea576222b51a841a6814a9c00d1 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 13 Apr 2016 18:00:46 -0700 Subject: [PATCH] [test] Fix use of uninitialized `dimensions` value (#4697) Instead of calling resize, which would compare against the uninitialized dimensions values, initialize dimensions and needsResize directly. --- platform/default/headless_view.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp index 9465f8ba9..a764eb2e0 100644 --- a/platform/default/headless_view.cpp +++ b/platform/default/headless_view.cpp @@ -7,16 +7,20 @@ namespace mbgl { HeadlessView::HeadlessView(float pixelRatio_, uint16_t width, uint16_t height) - : display(std::make_shared()), pixelRatio(pixelRatio_) { - resize(width, height); + : display(std::make_shared()) + , pixelRatio(pixelRatio_) + , dimensions({{ width, height }}) + , needsResize(true) { } HeadlessView::HeadlessView(std::shared_ptr display_, float pixelRatio_, uint16_t width, uint16_t height) - : display(std::move(display_)), pixelRatio(pixelRatio_) { - resize(width, height); + : display(std::move(display_)) + , pixelRatio(pixelRatio_) + , dimensions({{ width, height }}) + , needsResize(true) { } HeadlessView::~HeadlessView() {