diff -r 49c70dcc3f17 -r c863538fcbb6 hgcacheproxymodel/src/hgdataprovidermodel.cpp --- a/hgcacheproxymodel/src/hgdataprovidermodel.cpp Fri May 14 16:57:01 2010 +0300 +++ b/hgcacheproxymodel/src/hgdataprovidermodel.cpp Thu May 27 13:59:05 2010 +0300 @@ -13,7 +13,7 @@ * * Description: * -* Version : %version: 6 % +* Version : %version: 9 % */ #include #include @@ -149,6 +149,10 @@ void HgDataProviderModel::clearCache() { + for ( int i=0; ibegin(), mCache->end() ); mCache->clear(); } @@ -162,7 +166,7 @@ { bool change(false); if (list && list->count() && pos >=0 && posat(pos)) { - while(list->count()){ + while(list->count()>0){ QPair< QVariant, int > pair = list->takeFirst(); change = update(pos, pair.first, pair.second, true)|change; } @@ -239,10 +243,8 @@ void HgDataProviderModel::doInsertItem(int pos, QList< QPair< QVariant, int > >* list, bool silent) { - if (pos >mCache->count()){ - pos = mCache->count(); - } else if (pos <0){ - pos = 0; + if (pos >mCache->count() || pos <0){ + return; } if ( !silent){ @@ -267,9 +269,9 @@ void HgDataProviderModel::removeItems(int pos, int size) { - if (pos >mCache->count()) + if (pos >=mCache->count()){ return; - else if (pos <0){ + } else if (pos <0){ size = size + pos; //pos <0 pos = 0; }