Popcorn Maker – Bug 157

I have started to work on Popcorn Maker, the authoring tool for Popcorn, as part of David Humphrey‘s Open Source class. The code can be found on GitHub. The first bug that I decided to work on is bug 157, which presented a problem with the way tracks are numbered in Popcorn Maker. Before explaining the issue, here is a picture outlining where the tracks are (click on the image for the full screen picture):

Popcorn Maker  Tracks 1

Notice that the first track is labeled LAYER-TRACK0, and the second one is LAYER-TRACK1. If the project is saved and reloaded, these names should remain the same. But what actually happens is this:

Popcorn Maker  Bug 157

Notice now that the name of the first track is LAYER-TRACK2, one number higher than the name of the last track, LAYER-TRACK0, before we saved and reloaded the project.

The tracks are named using a consistent format, LAYER-TRACK#, where # is one higher than the previous number, unless it’s the first track, in which case it’s 0. The way # gets filled in is through a static variable, Track.guid. It’s initalized to 0, and then increased by 1 each time a new track is created. The problem is that Track.guid is never cleared back to 0 when the instance of Butter that Popcorn Maker is using is told to clearProject(). So the fix is actually easy: set Track.guid to 0 in the clearProject function in butter/src/butter-main.js:

butter/src/butter-main.js

      this.clearProject = function() {
        while ( targets.length > 0 ) {
          that.removeTarget( targets[ 0 ] );
        }
        while ( medias.length > 0 ) {
          that.removeMedia( medias[ 0 ] );
        }
        Track.guid = 0;
      };

This one line fix is now up for review.

Advertisements
This entry was posted in Open Source and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s