Skip to content
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

TIMOB-8990: Ti functions don't work in event callbacks #66

Merged

Conversation

dcampbell-macadamian
Copy link

Reviewers: David L, Alex

Description:
This patch fixes the problem of JS functions not calling back to the runtime. This patch calls "setVisible(false)" in the "clicked" event on the button object. In previous verions, this wouldn't work because it was never passed to the runtime.

Change Log:

  • created a callback for Cascades message loop
  • changed V8 scope so context doesn't go out of scope before events are handled
  • application exits when a JS exception occurs

Test Cases:

  • build tibb
  • build tibbtest
  • run tibbtest in simulator or device
  • push the button - it should disappear

Note:
This patch addresses issues:
https://jira.appcelerator.org/browse/TIMOB-8990
https://jira.appcelerator.org/browse/TIMOB-9203

Reviewers: David L, Alex

Description:
This patch fixes the problem of JS functions not calling back to the runtime. This patch calls "setVisible(false)" in the "clicked" event on the button object. In previous verions, this wouldn't work because it was never passed to the runtime.

Change Log:
- created a callback for Cascades message loop
- changed V8 scope so context doesn't go out of scope before events are handled
- application exits when a JS exception occurs

Test Cases:
- build tibb
- build tibbtest
- run tibbtest in simulator or device
- push the button - it should disappear

Note:
This patch addresses issues:
https://jira.appcelerator.org/browse/TIMOB-8990
https://jira.appcelerator.org/browse/TIMOB-9203
@alexandergalstyan
Copy link

Approved

}
// TODO: implement a message pump here
return bb::cascades::Application::exec();
objectFactory_ = &objFactory;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the idea of setting a member variable with a reference to memory on the stack, but since it's a private member and seems to never get referenced after the function ends, it should be ok. If I'm wrong about referencing it later then this needs to be in the heap.

@dlifshitz-maca
Copy link

Approved.

objectFactory_ = &objFactory;
mainApp_ = &mainApp;
int ret = obj->executeScript(&objFactory, javaScript_, messageLoop, this);
// TODO: handle non-zero return code here
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a Jira associated with that TODO? Otherwise what's preventing this from being done as part of this patch? If there's a reason to do it separately, then let's make sure there is a jira tracking that

dcampbell-macadamian added a commit that referenced this pull request Jun 1, 2012
TIMOB-8990: Ti functions don't work in event callbacks
@dcampbell-macadamian dcampbell-macadamian merged commit 71aa8b1 into Macadamian:blackberry Jun 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants