Skip to content

Commit

Permalink
fix bug with nodes count is small
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Apr 8, 2021
1 parent 006e320 commit d3e32dc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/pointcloud/qgspointcloudlayerrenderer.cpp
Expand Up @@ -238,12 +238,13 @@ int QgsPointCloudLayerRenderer::renderNodesAsync( const QVector<IndexedPointClou
QElapsedTimer downloadTimer;
downloadTimer.start();

int groupSize = 4;
const int groupSize = 4;
for ( int groupIndex = 0; groupIndex < nodes.size(); groupIndex += groupSize )
{
// Async loading of nodes
QVector<QgsPointCloudBlockRequest *> blockRequests( std::min( nodes.size() - groupIndex, groupSize ), nullptr );
QVector<bool> finishedLoadingBlock( std::min( nodes.size() - groupIndex, groupSize ), false );
const int currentGroupSize = std::min( std::max( nodes.size() - groupIndex, 0 ), groupSize );
QVector<QgsPointCloudBlockRequest *> blockRequests( currentGroupSize, nullptr );
QVector<bool> finishedLoadingBlock( currentGroupSize, false );
QEventLoop loop;

// Note: All capture by reference warnings here shouldn't be an issue since we have an event loop, so locals won't be deallocated
Expand Down

0 comments on commit d3e32dc

Please sign in to comment.