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.
This commit is contained in:
@@ -44,6 +44,9 @@ public:
|
|||||||
~ErrorMessageData();
|
~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);
|
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 */
|
/** Check whether error window shall display a company manager face */
|
||||||
bool HasFace() const { return face != INVALID_COMPANY; }
|
bool HasFace() const { return face != INVALID_COMPANY; }
|
||||||
|
|
||||||
|
@@ -113,6 +113,9 @@ struct GRFError {
|
|||||||
GRFError(StringID severity, StringID message = 0);
|
GRFError(StringID severity, StringID message = 0);
|
||||||
GRFError(const GRFError &error);
|
GRFError(const GRFError &error);
|
||||||
|
|
||||||
|
/* Remove the copy assignment, as the default implementation will not do the right thing. */
|
||||||
|
GRFError &operator=(GRFError &rhs) = delete;
|
||||||
|
|
||||||
std::string custom_message; ///< Custom message (if present)
|
std::string custom_message; ///< Custom message (if present)
|
||||||
std::string data; ///< Additional data for message and custom_message
|
std::string data; ///< Additional data for message and custom_message
|
||||||
StringID message; ///< Default message
|
StringID message; ///< Default message
|
||||||
@@ -154,6 +157,9 @@ struct GRFConfig : ZeroedMemoryAllocator {
|
|||||||
GRFConfig(const GRFConfig &config);
|
GRFConfig(const GRFConfig &config);
|
||||||
~GRFConfig();
|
~GRFConfig();
|
||||||
|
|
||||||
|
/* Remove the copy assignment, as the default implementation will not do the right thing. */
|
||||||
|
GRFConfig &operator=(GRFConfig &rhs) = delete;
|
||||||
|
|
||||||
GRFIdentifier ident; ///< grfid and md5sum to uniquely identify newgrfs
|
GRFIdentifier ident; ///< grfid and md5sum to uniquely identify newgrfs
|
||||||
uint8 original_md5sum[16]; ///< MD5 checksum of original file if only a 'compatible' file was loaded
|
uint8 original_md5sum[16]; ///< MD5 checksum of original file if only a 'compatible' file was loaded
|
||||||
char *filename; ///< Filename - either with or without full path
|
char *filename; ///< Filename - either with or without full path
|
||||||
|
Reference in New Issue
Block a user