Announcements and discussion regarding any projects related to Cyan Worlds' Plasma Engine including (but not limited to) CyanWorlds.com Engine, Drizzle, OfflineKI, PyPRP, and libHSPlasma.
by Branan » Thu Feb 18, 2010 4:41 pm
The following code:
- Code: Select all
hsTArray a;
a = a
will not work as expected. 'a' clears its data structures, then attempts to copy from itself, copying nothing. The correct method is to check for self-assignment. Patch:
- Code: Select all
Index: core/Util/hsTArray.hpp
===================================================================
--- core/Util/hsTArray.hpp (revision 359)
+++ core/Util/hsTArray.hpp (working copy)
@@ -26,6 +26,8 @@
}
hsTArray<T>& operator=(const hsTArray& cpy) {
+ if (&cpy == this) return *this;
+
clear();
count = cpy.count;
data = new T[count];
Your friendly neighborhood shard admin
-
Branan
- Gehn Shard Admin
-
- Posts: 694
- Joined: Fri Nov 16, 2007 9:45 pm
- Location: Portland, OR
by Zrax » Thu Feb 18, 2010 6:40 pm
Hmm, dunno why anyone would do that, but thanks anyway for catching it
EDIT: Applied fix to hsTList as well
-
Zrax
-
- Posts: 206
- Joined: Fri Sep 28, 2007 5:19 pm
- Location: Waist-deep in a conecano
-
Return to Plasma Development
Who is online
Users browsing this forum: No registered users and 20 guests