summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/dvector.h8
-rw-r--r--core/math/a_star.cpp2
-rw-r--r--core/math/math_funcs.h8
3 files changed, 12 insertions, 6 deletions
diff --git a/core/dvector.h b/core/dvector.h
index 2e951b9661..4584a300f9 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -92,6 +92,7 @@ class PoolVector {
// ERR_FAIL_COND(alloc->lock>0); should not be illegal to lock this for copy on write, as it's a copy on write after all
+ // Refcount should not be zero, otherwise it's a misuse of COW
if (alloc->refcount.get() == 1)
return; //nothing to do
@@ -216,7 +217,12 @@ class PoolVector {
{
int cur_elements = alloc->size / sizeof(T);
- Write w = write();
+
+ // Don't use write() here because it could otherwise provoke COW,
+ // which is not desirable here because we are destroying the last reference anyways
+ Write w;
+ // Reference to still prevent other threads from touching the alloc
+ w._ref(alloc);
for (int i = 0; i < cur_elements; i++) {
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 320990cc50..838fec22f0 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -401,7 +401,7 @@ void AStar::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_weight_scale", "id"), &AStar::get_point_weight_scale);
ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar::remove_point);
- ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id"), &AStar::connect_points, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id", "bidirectional"), &AStar::connect_points, DEFVAL(true));
ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar::disconnect_points);
ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id"), &AStar::are_points_connected);
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index dd64b10f88..45509a0808 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -110,8 +110,8 @@ public:
static _ALWAYS_INLINE_ bool is_inf(double p_val) {
#ifdef _MSC_VER
return !_finite(p_val);
-// workaround for mingw builds on travis
-#elif defined(__MINGW32__) || defined(__MINGW64__)
+// use an inline implementation of isinf as a workaround for problematic libstdc++ versions from gcc 5.x era
+#elif defined(__GNUC__) && __GNUC__ < 6
union {
uint64_t u;
double f;
@@ -127,8 +127,8 @@ public:
static _ALWAYS_INLINE_ bool is_inf(float p_val) {
#ifdef _MSC_VER
return !_finite(p_val);
-// workaround for mingw builds on travis
-#elif defined(__MINGW32__) || defined(__MINGW64__)
+// use an inline implementation of isinf as a workaround for problematic libstdc++ versions from gcc 5.x era
+#elif defined(__GNUC__) && __GNUC__ < 6
union {
uint32_t u;
float f;