diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/window.cpp | 10 | ||||
-rw-r--r-- | src/window_gui.h | 13 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp index 1b7430aee..c9bead7fd 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2350,3 +2350,13 @@ void RelocateAllWindows(int neww, int newh) w->top = top; } } + +/** Destructor of the base class PickerWindowBase + * Main utility is to stop the base Window destructor from triggering + * a free while the child will already be free, in this case by the ResetObjectToPlace(). + */ +PickerWindowBase::~PickerWindowBase() +{ + this->window_class = WC_INVALID; // stop the ancestor from freeing the already (to be) child + ResetObjectToPlace(); +} diff --git a/src/window_gui.h b/src/window_gui.h index 94482b254..8d527f95f 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -256,7 +256,7 @@ struct ViewportData : ViewPort { int32 dest_scrollpos_y; }; - /** +/** * Data structure for an opened window */ struct Window : ZeroedMemoryAllocator { @@ -493,6 +493,17 @@ public: /*** End of the event handling ***/ }; +/** + * Data structure for a window opened from a toolbar + */ +class PickerWindowBase : public Window { + +public: + PickerWindowBase(const WindowDesc *desc) : Window(desc) {}; // nothing special yet, just propagation + + virtual ~PickerWindowBase(); +}; + enum SortListFlags { VL_NONE = 0, ///< no sort VL_DESC = 1 << 0, ///< sort descending or ascending |