New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters to callback being overwritten by method call inside callback #976

Closed
crabmusket opened this Issue Nov 29, 2014 · 9 comments

Comments

Projects
None yet
2 participants
@crabmusket
Contributor

crabmusket commented Nov 29, 2014

Using this simple main.cs:

setLogMode(2);

new EventManager(Events)
{
   queue = EventQueue;
};
Events.registerEvent(SomeEvent);

new ScriptMsgListener(Listener);

registerMessageListener(EventQueue, Listener);

function Listener::onMessageReceived(%this, %queue, %message, %data)
{
   %this.isMethod(onSomeEvent);
   return true;
}

Events.postEvent(SomeEvent);

The following behaviour is observed:

bug

Notice how the value of event changes after the call. The code in question is here. Going to check if this is the same in 3.6.

Of course, whatever string value is in the call to %this.isMethod shows up in event after the callback. It happens identically with %this.setName, but not with echo, so I'm going to assume it's something to do with method calls.

@crabmusket crabmusket added the Bug label Nov 29, 2014

@crabmusket crabmusket added this to the 3.7 milestone Nov 29, 2014

@jamesu

This comment has been minimized.

Show comment
Hide comment
@jamesu

jamesu Nov 29, 2014

Contributor

Will have a look later

Contributor

jamesu commented Nov 29, 2014

Will have a look later

@crabmusket

This comment has been minimized.

Show comment
Hide comment
@crabmusket

crabmusket Nov 29, 2014

Contributor

Hahaha. Ha. sob

Contributor

crabmusket commented Nov 29, 2014

Hahaha. Ha. sob

@crabmusket crabmusket changed the title from Parameters to callback being overwritten to Parameters to callback being overwritten by method call inside callback Nov 29, 2014

@crabmusket

This comment has been minimized.

Show comment
Hide comment
@crabmusket

crabmusket Nov 29, 2014

Contributor

Confirmed not happening in 3.6 so it must be one of yours @jamesu ;).

Contributor

crabmusket commented Nov 29, 2014

Confirmed not happening in 3.6 so it must be one of yours @jamesu ;).

@jamesu

This comment has been minimized.

Show comment
Hide comment
@jamesu

jamesu Dec 7, 2014

Contributor

Currently investigating

Contributor

jamesu commented Dec 7, 2014

Currently investigating

@crabmusket

This comment has been minimized.

Show comment
Hide comment
@crabmusket

crabmusket Dec 7, 2014

Contributor

I love you.

Contributor

crabmusket commented Dec 7, 2014

I love you.

@jamesu

This comment has been minimized.

Show comment
Hide comment
@jamesu

jamesu Dec 7, 2014

Contributor

When issuing the call within the function, the stack pointer is 0. Thus the value gets overwritten. Why is the stack pointer 0? Because executef is resetting it to 0, though with good intentions.

Need to do a little refactoring of the stack manipulation code to fix this properly. Should be fixed sometime tomorrow.

Contributor

jamesu commented Dec 7, 2014

When issuing the call within the function, the stack pointer is 0. Thus the value gets overwritten. Why is the stack pointer 0? Because executef is resetting it to 0, though with good intentions.

Need to do a little refactoring of the stack manipulation code to fix this properly. Should be fixed sometime tomorrow.

@jamesu

This comment has been minimized.

Show comment
Hide comment
@jamesu

jamesu Dec 9, 2014

Contributor

Have a fix for this. Testing and will submit a PR soon.

Contributor

jamesu commented Dec 9, 2014

Have a fix for this. Testing and will submit a PR soon.

@jamesu

This comment has been minimized.

Show comment
Hide comment
@jamesu

jamesu Dec 10, 2014

Contributor

Patch submitted, let me know if it fixes your problem

Contributor

jamesu commented Dec 10, 2014

Patch submitted, let me know if it fixes your problem

@crabmusket

This comment has been minimized.

Show comment
Hide comment
@crabmusket

crabmusket Dec 10, 2014

Contributor

Works for me :).

Contributor

crabmusket commented Dec 10, 2014

Works for me :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment