Ignore:
Timestamp:
12/29/07 16:53:59 (4 years ago)
Author:
sander
Message:

Some minor things and a memleak

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gui/playlisttablemodel.cpp

    r9 r15  
    66{ 
    77    songs = new QList<Song *>; 
    8     song_id = 0; 
     8    song_id = -1; 
    99} 
    1010 
     
    7777void PlaylistTableModel::updateCurrentSong(quint32 id) 
    7878{ 
    79     quint32 oldIndex = 0; 
     79    qint32 oldIndex = -1; 
    8080 
    8181    oldIndex = song_id; 
    8282    song_id = id; 
    8383 
    84     if(oldIndex != 0) 
     84    if(oldIndex != -1) 
    8585        emit dataChanged(index(songIdToRow(oldIndex), 0), index(songIdToRow(oldIndex), 2)); 
    8686 
     
    9191{ 
    9292    // Update song list and refresh model 
     93    while(this->songs->size()) 
     94        delete this->songs->takeLast(); 
     95 
    9396    delete this->songs; 
     97 
    9498    this->songs = songs; 
    9599    reset(); 
    96100} 
    97101 
    98 quint32 PlaylistTableModel::getIdByRow(quint32 row) const 
     102qint32 PlaylistTableModel::getIdByRow(qint32 row) const 
    99103{ 
    100104    if(songs->size() <= row) { 
     
    105109} 
    106110 
    107 qint32 PlaylistTableModel::songIdToRow(quint32 id) 
     111qint32 PlaylistTableModel::songIdToRow(qint32 id) 
    108112{ 
    109113    for(qint32 i = 0; i < songs->size(); i++) { 
Note: See TracChangeset for help on using the changeset viewer.