New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEGV (on Linux) with latest Minetest Master #14271
Comments
The thread name |
Ah no, the reason is more simple. In ModifySafeMap we replace the value with an empty unique_ptr here, thinking it's equivalent to removal the key from the map. But emplace here doesn't think so and fails because there is such key in the map already. Therefore ServerActiveObject becomes destroyed, and we access it here. No crashes with this patch: diff --git a/src/util/container.h b/src/util/container.h
index 985a9a447..a8dd74c4d 100644
--- a/src/util/container.h
+++ b/src/util/container.h
@@ -377,9 +377,9 @@ class ModifySafeMap
return;
}
if (m_iterating)
- m_new.emplace(key, value);
+ m_new[key] = value;
else
- m_values.emplace(key, value);
+ m_values[key] = value;
}
void put(const K &key, V &&value) {
@@ -388,9 +388,9 @@ class ModifySafeMap
return;
}
if (m_iterating)
- m_new.emplace(key, std::move(value));
+ m_new[key] = std::move(value);
else
- m_values.emplace(key, std::move(value));
+ m_values[key] = std::move(value);
} |
@savilli I can confirm that your change works. |
Good catch on the bug, but I discovered a few more edge cases I need to fix.
That's okay actually. |
Minetest version
Active renderer
N/A
Irrlicht device
N/A
Operating system and version
Linux, Fedora 38
CPU model
Intel
GPU model
N/A
OpenGL version
N/A
Summary
Here's the backtrace:
This is due to some commit AFTER b12be04
Steps to reproduce
Somewhat reliably with Mineclonia. Just starting a new world, after a few seconds MT crashes.
The text was updated successfully, but these errors were encountered: