Skip to content

Commit

Permalink
Merge pull request #2630 from AnalyticalGraphicsInc/never-mind
Browse files Browse the repository at this point in the history
Fix crash when adding and removing a billboard before next update.
  • Loading branch information
emackey committed Apr 10, 2015
2 parents b691b8a + ec773ab commit 831e467
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/Scene/BillboardCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,8 @@ define([
* @exception {RuntimeError} image with id must be in the atlas.
*/
BillboardCollection.prototype.update = function(context, frameState, commandList) {
removeBillboards(this);

var billboards = this._billboards;
var billboardsLength = billboards.length;

Expand All @@ -1036,7 +1038,6 @@ define([
return;
}

removeBillboards(this);
updateMode(this, frameState);

billboards = this._billboards;
Expand Down
6 changes: 6 additions & 0 deletions Specs/Scene/BillboardCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ defineSuite([
expect(b.id).not.toBeDefined();
});

it('can add and remove before first update.', function() {
var b = billboards.add();
billboards.remove(b);
billboards.update(context, frameState, []);
});

it('explicitly constructs a billboard', function() {
var b = billboards.add({
show : false,
Expand Down

0 comments on commit 831e467

Please sign in to comment.