Skip to content
Permalink
Browse files

Lock render method with mutex. Usefull e.g. for globe plugin which re…

…nders in threads
  • Loading branch information
mhugent committed Jul 2, 2011
1 parent 8e5cd40 commit 71443b1206ae73f5ebf37b8016fe02ad98812596
Showing with 8 additions and 0 deletions.
  1. +4 −0 src/core/qgsmaprenderer.cpp
  2. +4 −0 src/core/qgsmaprenderer.h
@@ -33,6 +33,7 @@

#include <QDomDocument>
#include <QDomNode>
#include <QMutexLocker>
#include <QPainter>
#include <QListIterator>
#include <QSettings>
@@ -214,6 +215,9 @@ void QgsMapRenderer::adjustExtentToSize()

void QgsMapRenderer::render( QPainter* painter )
{
//Lock render method for concurrent threads (e.g. from globe)
QMutexLocker renderLock( &mRenderMutex );

//flag to see if the render context has changed
//since the last time we rendered. If it hasnt changed we can
//take some shortcuts with rendering
@@ -16,6 +16,7 @@
#ifndef QGSMAPRENDER_H
#define QGSMAPRENDER_H

#include <QMutex>
#include <QSize>
#include <QStringList>
#include <QVector>
@@ -318,6 +319,9 @@ class CORE_EXPORT QgsMapRenderer : public QObject

//! Labeling engine (NULL by default)
QgsLabelingEngineInterface* mLabelingEngine;

//! Locks rendering loop for concurrent draws
QMutex mRenderMutex;
};

#endif

0 comments on commit 71443b1

Please sign in to comment.
You can’t perform that action at this time.