From 93afff1d1adf627cdaef139dbeb0ebe256f7b564 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Mon, 12 Aug 2019 12:36:07 +1100 Subject: [PATCH] Fixed regression from 4139b43cc900 (fixes #4215) This fixes the buttons in the editor's terrain palette being unselectable. Since the gui::widget class had a virtual base class, the class was not trivially copy-constructable. We need to explicitly define the copy constructor so we can initialize the sdl_handler base class. --- src/widgets/widget.cpp | 21 +++++++++++++++++++++ src/widgets/widget.hpp | 1 + 2 files changed, 22 insertions(+) diff --git a/src/widgets/widget.cpp b/src/widgets/widget.cpp index 7d19556101cc..3ab8a8a51595 100644 --- a/src/widgets/widget.cpp +++ b/src/widgets/widget.cpp @@ -30,6 +30,27 @@ namespace gui { bool widget::mouse_lock_ = false; +widget::widget(const widget& o) + : events::sdl_handler() + , focus_(o.focus_) + , video_(o.video_) + , restorer_(o.restorer_) + , rect_(o.rect_) + , needs_restore_(o.needs_restore_) + , state_(o.state_) + , hidden_override_(o.hidden_override_) + , enabled_(o.enabled_) + , clip_(o.clip_) + , clip_rect_(o.clip_rect_) + , volatile_(o.volatile_) + , help_text_(o.help_text_) + , tooltip_text_(o.tooltip_text_) + , help_string_(o.help_string_) + , id_(o.id_) + , mouse_lock_local_(o.mouse_lock_local_) +{ +} + widget::widget(CVideo& video, const bool auto_join) : events::sdl_handler(auto_join), focus_(true), video_(&video), rect_(EmptyRect), needs_restore_(false), state_(UNINIT), hidden_override_(false), enabled_(true), clip_(false), diff --git a/src/widgets/widget.hpp b/src/widgets/widget.hpp index a200f0f4507b..34f457bed82a 100644 --- a/src/widgets/widget.hpp +++ b/src/widgets/widget.hpp @@ -69,6 +69,7 @@ class widget : public events::sdl_handler virtual void process_tooltip_string(int mousex, int mousey); protected: + widget(const widget& o); widget(CVideo& video, const bool auto_join=true); virtual ~widget();