summaryrefslogtreecommitdiff
path: root/games/wesnoth/fix-segfault.patch
blob: 882231d99e1ad566e1b3e6b106049cd1edb8ff25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From bbd7f62a426e321034c7bdf9054152fc159e517a Mon Sep 17 00:00:00 2001
From: "J. Tyne" <jt_coding@verizon.net>
Date: Thu, 13 Dec 2012 14:22:35 +0000
Subject: [PATCH] Change some implicit conversions to return const references
 to objects...

...instead of temporary objects.

Fixes bug #20360.
---
 src/shared_object.hpp | 2 +-
 src/tstring.hpp       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared_object.hpp b/src/shared_object.hpp
index 89be3b8..a6099a8 100644
--- a/src/shared_object.hpp
+++ b/src/shared_object.hpp
@@ -51,7 +51,7 @@ class shared_object {
 		val_->count++;
 	}
 
-	operator T() const {
+	operator const T &() const {
 		assert(valid());
 		return val_->val;
 	}
diff --git a/src/tstring.hpp b/src/tstring.hpp
index a391d58..f4664f5 100644
--- a/src/tstring.hpp
+++ b/src/tstring.hpp
@@ -145,7 +145,7 @@ class t_string :
 	static t_string from_serialized(const std::string& string) { return t_string(base::from_serialized(string)); }
 	std::string to_serialized() const { return get().to_serialized(); }
 
-	operator t_string_base() const { return get(); }
+	operator const t_string_base &() const { return get(); }
 
 	t_string operator+(const t_string& o) const { return get() + o.get(); }
 	t_string operator+(const std::string& o) const { return get() + o; }
-- 
1.8.1.6