Hi,
I'm setting up a tree from a hierarchical listing of
category->album->track for organizing audio for display on a website.
The tree has drag/drop support so that tracks can be re-ordered or moved
into other albums, the same for albums into categories and the ordering
of categories. To implement this, I have custom classes descending from
either TreeFolder (categories/albums) or TreeItem (tracks) and
originally had code like so for removing a track from the old tree
branch prior to adding it to the new tree branch:
removeTrack: function(track)
{
var tracks = this.getModel().getTracks(); // tracks is an array
of qx.data.Array created from a JSON array
for (var i = 0; i < tracks.getLength(); i++) {
var t = tracks.getItem(i);
if (t.getId() == model.getId()) { // locate this track in
the model array
tracks.remove(t); // remove model from the model array
of tracks
this.remove(track); // remove the ui TreeFolder from its
parent
return;
}
}
},
This, however, resulted in an exception when I later tried to set the
track's album ID using:
track.getModel().setRecordid(this.getModel().getId());
in the addTrack function. The exception claimed that the model
qx.data.Array had already been freed. So, to fix this, I added:
var model = track.getModel().clone();
track.setModel(model);
to the top of removeTrack and the exception went away.
My question is: where and why is the model being freed, and is this
intended behavior or a bug? The removeAlbum() function is becoming
increasingly complex as I am forced to clone the entire model and reset
it for every single child track of the album as well as the album, so if
I don't need to do this, that would be great. I'm currently debugging
the problem that moving an album works, but then all of its tracks have
their model automatically freed.
Thanks,
Greg
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel