Skip to content

Commit c2f15af

Browse files
authored
fix the free calls in android string (#1490)
1 parent e5d8952 commit c2f15af

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

loader/src/c++stl/string.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,26 @@ namespace gd {
4848

4949
string& string::operator=(string const& other) {
5050
if (this != &other) {
51-
impl.free();
5251
impl.setStorage(other);
5352
}
5453
return *this;
5554
}
5655
string& string::operator=(string&& other) {
5756
// TODO: do this better :-)
58-
impl.free();
5957
impl.setStorage(other);
60-
implFor(other).free();
6158
implFor(other).setEmpty();
6259
return *this;
6360
}
6461
string& string::operator=(char const* other) {
65-
impl.free();
6662
impl.setStorage(other);
6763
return *this;
6864
}
6965
string& string::operator=(std::string const& other) {
70-
impl.free();
7166
impl.setStorage(other);
7267
return *this;
7368
}
7469

7570
void string::clear() {
76-
impl.free();
7771
impl.setEmpty();
7872
}
7973

loader/src/platform/android/gdstdlib.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ void setEmptyInternalString(gd::string* str) {
8282

8383
namespace geode::stl {
8484
void StringImpl::setEmpty() {
85+
this->free();
86+
8587
data.m_data = emptyInternalString();
8688
}
8789

0 commit comments

Comments
 (0)