diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 1d4233ed96..68e5fc9d1a 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -678,6 +678,7 @@ void Regex::Release() { delete (regex_t *)reg; reg = NULL; + pattern = ""; } Regex::Regex(const CString &str) @@ -689,8 +690,13 @@ Regex::Regex(const CString &str) Regex::Regex(const Regex &rhs) { reg = NULL; - pattern=rhs.pattern; - Compile(); + Set(rhs.pattern); +} + +Regex &Regex::operator=(const Regex &rhs) +{ + if(this != &rhs) Set(rhs.pattern); + return *this; } Regex::~Regex() diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 16dfc3be5f..7e6133a6ff 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -209,6 +209,7 @@ class Regex { public: Regex(const CString &pat = ""); Regex(const Regex &rhs); + Regex &operator=(const Regex &rhs); ~Regex(); void Set(const CString &str); bool Compare(const CString &str);