View Issue Details

IDProjectCategoryView StatusLast Update
0002137Multi Theft Auto : San AndreasScriptingpublic2007-06-05 14:16
ReporterjbetaAssigned Tokevuwk 
PrioritynormalSeveritytrivialReproducibilityalways
Status resolvedResolutionfixed 
PlatformAMD Athlon(tm) 64 X2 ~2.2GHzOSWindows XP Professional x64 SP1OS Version5.2, Build 3790
Product Versionblue_sa.r2.a12 
Target VersionFixed in Versionmtasadm_v1.0-dp1 
Summary0002137: removeEventHandler removes all identical handlers
Description

addEventHandler allows you to add a function as a handler to an event as many times as you want. But when you use removeEventHandler, all instances of that handler are removed, instead of just one.

Removing just the first/last may be better because the scripter can choose how many handlers to remove.

TagsNo tags attached.

Activities

Jax

2007-06-04 17:38

administrator   ~~0004717

Not sure what you mean, give an example?
..it should only remove 1 eventHandler:
addEventHandler ( "onConsole", "onConsoleA" )
addEventHandler ( "onConsole", "onConsoleB" )
removeEventHandler ( "onConsole", "onConsoleB" )
...onConsoleA remains

jbeta

2007-06-05 09:16

updater   ~~0004718

No, i mean adding the same function as a handler of the same event many times:

addEventHandler ( "onConsole",..., "onConsoleA" )
addEventHandler ( "onConsole",..., "onConsoleA" )

(At this point, "onConsoleA" is fired two times per event)

removeEventHandler ( "onConsole",..., "onConsoleA" )

(No "onConsoleA" handlers remain)

Jax

2007-06-05 09:41

administrator   ~~0004719

You shouldn't even be able to do that anyway, dunno why you'd want to either.

jbeta

2007-06-05 10:59

updater   ~~0004720

Me neither, I can think of a few examples but there are much better ways to code them.

Thing is, if you're allowing to add the same handler many times, this behavior is somewhat counterintuitive. Disallowing it is OK as well.

kevuwk

2007-06-05 12:24

administrator   ~~0004721

currently changed in the server so that 2 handlers can't perform the same event with the same name, might be worth making it so 2 handlers can't have the same name at all, will do the client aswell

Issue History

Date Modified Username Field Change