[v2.1] Incorrect reference count Topic is solved

Report problems with documented functionality
User avatar
thqby
Posts: 408
Joined: 16 Apr 2021, 11:18
Contact:

[v2.1] Incorrect reference count

09 Sep 2023, 05:55

Code: Select all

class abc {
	a: i8
	b: bcd
	; b:={}
	__Enum := enumer(['a','b'])
}
class bcd {
	e: i8
	f: i8
	__Enum := enumer(['e','f'])
}
enumer(props) {
	return (this, n) {
		em := props.__Enum()
		return (&k, &v) {
			if (em(&k))
				return (v := this.%k%, 1)
			return 0
		}
	}
}
a := abc()
for k, v in a
	(v)
User avatar
thqby
Posts: 408
Joined: 16 Apr 2021, 11:18
Contact:

Re: [v2.1] Incorrect reference count

09 Sep 2023, 05:57

I found that the reference count of the nested structure became -1, which eventually led to a crash.
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2.1] Incorrect reference count  Topic is solved

20 Sep 2023, 05:56

This was fixed in v2.1-alpha.5, but the code above is affected by at least one bug added by that version, fixed in v2.1-alpha.6.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 124 guests