Vice City: Multiplayer

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

Title: [BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: EK.IceFlake on July 7th, 2017, 07: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 July 7th, 2017, 07: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 July 7th, 2017, 09:07 AM
Quote from . on July 7th, 2017, 07:39 AM
And the info message is empty?
Yeah.
Title: [BUG] PlayerGameKeys catches an exception regardless of whether it was thrown
Post by: EK.IceFlake on July 9th, 2017, 03: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 July 9th, 2017, 05:47 PM
Quote from EK.IceFlake on July 9th, 2017, 03: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 July 9th, 2017, 06:25 PM
Quote from . on July 9th, 2017, 05:47 PM
Quote from EK.IceFlake on July 9th, 2017, 03: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.
Code: [Select]
local event = function (a, b) { };
player.On.GameKeys.Connect(event);
player.On.GameKeys.Disconnect(event);