Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

Commit dfab15b

Browse files
Fix various issues with the stack ID cache code
Re-defining integer limit macros is bad...
1 parent 2b85c29 commit dfab15b

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

engine/src/stackcache.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
2525

2626
////////////////////////////////////////////////////////////////////////////////
2727

28-
#define UINDEX_MAX UINT32_MAX
29-
#define UINDEX_MIN UINT32_MIN
30-
#define UINTPTR_MAX UINT32_MAX
31-
#define UINTPTR_MIN UINT32_MIN
32-
3328
class MCStackIdCache
3429
{
3530
public:
@@ -117,7 +112,7 @@ MCStackIdCache::~MCStackIdCache(void)
117112
if (t_bucket == UINTPTR_MIN || t_bucket == UINTPTR_MAX)
118113
continue;
119114

120-
MCObjectHandle t_handle = reinterpret_cast<MCObjectProxy<MCObject>*>(m_buckets[i]);
115+
MCObjectHandle t_handle = reinterpret_cast<MCObjectProxy<>*>(m_buckets[i]);
121116
t_handle.ExternalRelease();
122117
}
123118

@@ -170,8 +165,8 @@ void MCStackIdCache::UncacheObject(MCObjectHandle p_object)
170165

171166
if (t_target_slot != UINDEX_MAX)
172167
{
173-
p_object.ExternalRelease();
174168
p_object -> setinidcache(false);
169+
MCObjectHandle(reinterpret_cast<MCObjectProxy<>*>(m_buckets[t_target_slot])).ExternalRelease();
175170
m_buckets[t_target_slot] = UINTPTR_MAX;
176171
m_count -= 1;
177172
}
@@ -186,7 +181,7 @@ MCObjectHandle MCStackIdCache::FindObject(uint32_t p_id)
186181
t_target_slot = FindBucketIfExists(p_id, t_hash);
187182

188183
if (t_target_slot != UINDEX_MAX)
189-
return reinterpret_cast<MCObjectProxy<MCObject>*>(m_buckets[t_target_slot]);
184+
return MCObjectHandle(reinterpret_cast<MCObjectProxy<>*>(m_buckets[t_target_slot]));
190185

191186
return nil;
192187
}
@@ -224,7 +219,7 @@ uindex_t MCStackIdCache::FindBucket(uint32_t p_id, hash_t p_hash, bool p_only_if
224219

225220
if (t_bucket != UINTPTR_MAX)
226221
{
227-
MCObjectHandle t_handle = reinterpret_cast<MCObjectProxy<MCObject>*>(t_bucket);
222+
MCObjectHandle t_handle = reinterpret_cast<MCObjectProxy<>*>(t_bucket);
228223

229224
if (t_handle)
230225
{
@@ -336,7 +331,7 @@ bool MCStackIdCache::RehashBuckets(index_t p_new_item_count_delta)
336331
{
337332
if (t_old_buckets[i] != UINTPTR_MIN && t_old_buckets[i] != UINTPTR_MAX)
338333
{
339-
MCObjectHandle t_handle = reinterpret_cast<MCObjectProxy<MCObject>*>(t_old_buckets[i]);
334+
MCObjectHandle t_handle = reinterpret_cast<MCObjectProxy<>*>(t_old_buckets[i]);
340335

341336
// If the object is dead, don't transfer it to the new table
342337
if (!t_handle)

0 commit comments

Comments
 (0)