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

Component play should not execute if the component is not initialized #1565

Merged
merged 1 commit into from Jun 29, 2016

Conversation

dmarcos
Copy link
Member

@dmarcos dmarcos commented Jun 18, 2016

Description:

There's a bogus situation if play is called on a component that has not been yet initialized and the logic relies on something done in the init method.

The bug has manifested when the camera system pauses the inactive camera entity and plays the new active one. With the default camera the camera system calls play on the entity. The camera component is initialized before look-controls and its play method invoked before init. The play method of look-controls expects the methods to be bound before attaching the event listeners.

Changes proposed:
Ensure that play is never invoked before init and also prevent play/pause logic to be executed multiple times if the component is already playing or paused respectively.

NewComponent.prototype = Object.create(Component.prototype, proto);
NewComponent.prototype.name = name;
NewComponent.prototype.constructor = NewComponent;
NewComponent.prototype.system = systems && systems.systems[name];
// Wraps method to meet needed gurantees
Copy link
Member

Choose a reason for hiding this comment

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

Wraps methods to meet needed guarantees.

Can also explain what the "guarantees" are.

@dmarcos dmarcos merged commit fee93fc into aframevr:master Jun 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants