From 8db1c70e1edd3ca06012e3dbf9f04bdf7fa6a0c2 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 28 Mar 2003 05:23:35 +0000 Subject: [PATCH] add missing operator=; fixes a crash that only occurs after releasing snapshots --- stepmania/src/RageUtil.cpp | 10 ++++++++-- stepmania/src/RageUtil.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) 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);