Modify

Opened 16 years ago

Closed 16 years ago

#1234 closed Bug (Fixed)

Scripting.Dictionary call converting referenced AutoIt booleans to numbers

Reported by: Gabriel13 Owned by: Valik
Milestone: 3.3.1.5 Component: AutoIt
Version: 3.3.0.0 Severity: Blocking
Keywords: Cc:

Description

I've run into a situation where a Scripting.Dictionary object method call is changing variable types within an AutoIt array, simply by referencing them.

func testDictionary($a)
	local $d=objCreate('Scripting.Dictionary')
	for $i=0 to ubound($a)-1
		$d.add($i,$a[$i])
	next
	return $d
endfunc

local $aTest[2]=[false,true]

msgbox(0,default,$aTest[0]) ; displays false
msgbox(0,default,$aTest[1]) ; displays true

local $ignore=testDictionary($aTest)

msgbox(0,default,$aTest[0]) ; displays 0 instead of false
msgbox(0,default,$aTest[1]) ; displays 1 instead of true

Apparently, when the $d.add() call references $a[$i], it's also converting booleans to numbers within the array itself, and those changes are reflected in the original array afterwards.

In this example, the problem goes away if I change the top line to:

func testDictionary(const byRef $a)

I've verified that this bug is present in the 3.3.1.3 beta as well.

Attachments (0)

Change History (3)

comment:1 by Valik, 16 years ago

Severity: NoneBlocking

comment:2 by J-Paul Mesnage, 16 years ago

Owner: set to Valik
Status: newassigned

comment:3 by Valik, 16 years ago

Milestone: 3.3.1.5
Resolution: Fixed
Status: assignedclosed

Fixed by revision [5303] in version: 3.3.1.5

Modify Ticket

Action
as closed The owner will remain Valik.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.