summaryrefslogtreecommitdiff
path: root/src/error.h
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-26 21:48:28 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-27 18:30:56 +0200
commitdb54e208256958f721bf74bf058b45039be5b488 (patch)
treee1d74970d7f56e9ddc3be53562a86b33ab714635 /src/error.h
parent9197de39e4bf4c17ba6da82c2ed1b858603a443a (diff)
downloadopenttd-db54e208256958f721bf74bf058b45039be5b488.tar.xz
Change: mark copy-assignment as deleted for classes with a copy-constructor that is not trivial
This to prevent the default copy-assignment getting used when during the assignment also some other memory needs to be allocated as that would otherwise be freed.
Diffstat (limited to 'src/error.h')
-rw-r--r--src/error.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/error.h b/src/error.h
index 6dd4b0234..9c445fc48 100644
--- a/src/error.h
+++ b/src/error.h
@@ -44,6 +44,9 @@ public:
~ErrorMessageData();
ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration = 0, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = nullptr, uint textref_stack_size = 0, const uint32 *textref_stack = nullptr);
+ /* Remove the copy assignment, as the default implementation will not do the right thing. */
+ ErrorMessageData &operator=(ErrorMessageData &rhs) = delete;
+
/** Check whether error window shall display a company manager face */
bool HasFace() const { return face != INVALID_COMPANY; }