From 18ae9c78bc238ec3f51b778226d4769cee030f39 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 15 Jun 2013 15:06:22 +0000 Subject: [PATCH] (svn r25402) -Fix-ish: Prevent copying of BasePool and WindowDesc, since they register in static vectors. --- src/core/pool_type.hpp | 7 +++++++ src/window.cpp | 1 + src/window_gui.h | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/src/core/pool_type.hpp b/src/core/pool_type.hpp index 131b5cef7e..f19e444798 100644 --- a/src/core/pool_type.hpp +++ b/src/core/pool_type.hpp @@ -59,6 +59,13 @@ struct PoolBase { * Virtual method that deletes all items in the pool. */ virtual void CleanPool() = 0; + +private: + /** + * Dummy private copy constructor to prevent compilers from + * copying the structure, which fails due to GetPools(). + */ + PoolBase(const PoolBase &other); }; /** diff --git a/src/window.cpp b/src/window.cpp index e4041c3195..40b7100441 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -106,6 +106,7 @@ WindowDesc::WindowDesc(WindowPosition def_pos, const char *ini_key, int16 def_wi WindowDesc::~WindowDesc() { + _window_descs->Erase(_window_descs->Find(this)); } /** diff --git a/src/window_gui.h b/src/window_gui.h index 6288aadc1d..c5c37be850 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -197,6 +197,13 @@ struct WindowDesc : ZeroedMemoryAllocator { static void LoadFromConfig(); static void SaveToConfig(); + +private: + /** + * Dummy private copy constructor to prevent compilers from + * copying the structure, which fails due to _window_descs. + */ + WindowDesc(const WindowDesc &other); }; /**