Modify

Opened 10 years ago

Closed 10 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 Changed 10 years ago by Valik

  • Severity changed from None to Blocking

comment:2 Changed 10 years ago by Jpm

  • Owner set to Valik
  • Status changed from new to assigned

comment:3 Changed 10 years ago by Valik

  • Milestone set to 3.3.1.5
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [5303] in version: 3.3.1.5

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Valik.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.