Vice City: Multiplayer

Community Projects => SLC's Squirrel Plugin => Bug Reports => Topic started by: EK.IceFlake on Jul 07, 2017, 06:23 AM

Title: [BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: EK.IceFlake on Jul 07, 2017, 06:23 AM
I get this:
[ERR] Squirrel exception caught (OnPlayerGameKeysChange) event
[INF] Message:

even with an empty callback on PlayerGameKeys.
Title: Re:[BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: . on Jul 07, 2017, 06:39 AM
And the info message is empty? I guess I'll have to test this when I get the time because I'm not sure exactly what causes this.
Title: Re:[BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: EK.IceFlake on Jul 07, 2017, 08:07 AM
Quote from: . on Jul 07, 2017, 06:39 AMAnd the info message is empty?
Yeah.
Title: [BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: EK.IceFlake on Jul 09, 2017, 02:59 PM
Doesn't happen anymore. Very mysterious problem.
:edit: Figured it out. It happens when I .Disconnect my event handler. All further calls to it cause an error.
Title: Re:[BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: . on Jul 09, 2017, 04:47 PM
Quote from: EK.IceFlake on Jul 09, 2017, 02:59 PM:edit: Figured it out. It happens when I .Disconnect my event handler. All further calls to it cause an error.

I did try my best to make the signals and slots implementation immune to issues caused by modifications during emission. But I guess this was only valid when I was doing it just with C++. When Squirrel was added to the mix, it had to mess up something. Not the first time Squirrel does goes nasty.

If you happen to come across further information that can lead you to make an example which reproduces the issue. Feel free to report back here so I can look into it.
Title: Re:[BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: EK.IceFlake on Jul 09, 2017, 05:25 PM
Quote from: . on Jul 09, 2017, 04:47 PM
Quote from: EK.IceFlake on Jul 09, 2017, 02:59 PM:edit: Figured it out. It happens when I .Disconnect my event handler. All further calls to it cause an error.

I did try my best to make the signals and slots implementation immune to issues caused by modifications during emission. But I guess this was only valid when I was doing it just with C++. When Squirrel was added to the mix, it had to mess up something. Not the first time Squirrel does goes nasty.

If you happen to come across further information that can lead you to make an example which reproduces the issue. Feel free to report back here so I can look into it.

local event = function (a, b) { };
player.On.GameKeys.Connect(event);
player.On.GameKeys.Disconnect(event);