[BUG] PlayerGameKeys catches an exception regardless of whether it was thrown

Started by EK.IceFlake, Jul 07, 2017, 06:23 AM

Previous topic - Next topic

EK.IceFlake

I get this:
[ERR] Squirrel exception caught (OnPlayerGameKeysChange) event
[INF] Message:

even with an empty callback on PlayerGameKeys.

.

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.
.

EK.IceFlake


EK.IceFlake

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.

.

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.
.

EK.IceFlake

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);