mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-03 14:05:17 +00:00
assertions added to inspect potential bug in playlist item deletion code
formatting cleanups in random number generators git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@857 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -61,11 +61,10 @@ inline std::size_t uniformInteger(std::size_t upperBound=1) {
|
||||
|
||||
inline std::size_t weightedRandom(const std::vector<int> & weights, int weightTotalHint = 0) {
|
||||
|
||||
if (weightTotalHint == 0)
|
||||
for (std::size_t i = 0; i < weights.size();i++) {
|
||||
if (weightTotalHint <= 0)
|
||||
for (std::size_t i = 0; i < weights.size();i++)
|
||||
weightTotalHint += weights[i];
|
||||
}
|
||||
|
||||
|
||||
int sampledSum = uniformInteger(weightTotalHint);
|
||||
int sum = 0;
|
||||
|
||||
|
||||
@ -509,6 +509,7 @@ void QProjectM_MainWindow::removePlaylistItems(const QModelIndexList & items) {
|
||||
}
|
||||
|
||||
PlaylistItemVector & lastCachedItems = *historyHash[previousFilter];
|
||||
assert (lastCachedItems.size() == playlistModel->rowCount());
|
||||
|
||||
QVector<long> zombieItems;
|
||||
|
||||
@ -531,7 +532,7 @@ void QProjectM_MainWindow::removePlaylistItems(const QModelIndexList & items) {
|
||||
int index = cachedItems.indexOf(id);
|
||||
if (index >= 0)
|
||||
cachedItems.remove(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (int key, reverseOrderKeys) {
|
||||
|
||||
Reference in New Issue
Block a user