I have put a lot of effort to rewrite huge part of my app to work with QValueVector but all in vain. Below I present proof of this broken component. Correct me if I'm wrong and I'll be happy.
My code:
qDebug(">");
playlistsList::iterator i, j;
i = playlists.begin();
j = i;
i += where;
//qDebug(playlists.at(which).name);
//qDebug((*i).name);
for (int i = 0 ; i != playlists.count() ; i++, j++)
{
qDebug(playlists.at(i).name + " " + (*j).name);
}
qDebug("i'll insert " + playlists.at(which).name + " before " + (*i).name);
playlists.insert(i, playlists.at(which));
for (int i = 0 ; i != playlists.count() ; i++)
qDebug(playlists.at(i).name);
qDebug("after redundant removed");
i = playlists.begin();
j = i;
i += (which + 1);
playlists.erase(i);
for (int i = 0 ; i != playlists.count() ; i++, j++)
qDebug(playlists.at(i).name + " " + (*j).name);
qDebug("");
qDebug("");
qDebug(">");
playlistsList::iterator i, j;
i = playlists.begin();
j = i;
i += where;
//qDebug(playlists.at(which).name);
//qDebug((*i).name);
for (int i = 0 ; i != playlists.count() ; i++, j++)
{
qDebug(playlists.at(i).name + " " + (*j).name);
}
qDebug("i'll insert " + playlists.at(which).name + " before " + (*i).name);
playlists.insert(i, playlists.at(which));
for (int i = 0 ; i != playlists.count() ; i++)
qDebug(playlists.at(i).name);
qDebug("after redundant removed");
i = playlists.begin();
j = i;
i += (which + 1);
playlists.erase(i);
for (int i = 0 ; i != playlists.count() ; i++, j++)
qDebug(playlists.at(i).name + " " + (*j).name);
qDebug("");
qDebug("");
To copy to clipboard, switch view to plain text mode
Results after first execution of above code are correct:
>
aa aa
bb bb
i'll insert bb before aa
bb
aa
bb
after redundant removed
bb bb
aa aa
>
aa aa
bb bb
i'll insert bb before aa
bb
aa
bb
after redundant removed
bb bb
aa aa
To copy to clipboard, switch view to plain text mode
Second execution gives INCORRECT result:
>
bb bb
aa aa
i'll insert aa before bb
bb
bb
aa
after redundant removed
bb bb
bb bb
>
bb bb
aa aa
i'll insert aa before bb
bb
bb
aa
after redundant removed
bb bb
bb bb
To copy to clipboard, switch view to plain text mode
Can anyone help me?
Bookmarks