mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:36:39 +02:00
added missing locking against crashing in Overlays::~Overlays()
This commit is contained in:
parent
3e671c1968
commit
c832df0783
1 changed files with 19 additions and 9 deletions
|
@ -22,16 +22,26 @@ Overlays::Overlays() : _nextOverlayID(1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Overlays::~Overlays() {
|
Overlays::~Overlays() {
|
||||||
QMap<unsigned int, Overlay*>::iterator it;
|
|
||||||
for (it = _overlays2D.begin(); it != _overlays2D.end(); ++it) {
|
{
|
||||||
delete _overlays2D.take(it.key());
|
QWriteLocker lock(&_lock);
|
||||||
}
|
foreach(Overlay* thisOverlay, _overlays2D) {
|
||||||
for (it = _overlays3D.begin(); it != _overlays3D.end(); ++it) {
|
delete thisOverlay;
|
||||||
delete _overlays3D.take(it.key());
|
}
|
||||||
}
|
_overlays2D.clear();
|
||||||
while (!_overlaysToDelete.isEmpty()) {
|
foreach(Overlay* thisOverlay, _overlays3D) {
|
||||||
delete _overlaysToDelete.takeLast();
|
delete thisOverlay;
|
||||||
|
}
|
||||||
|
_overlays3D.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_overlaysToDelete.isEmpty()) {
|
||||||
|
QWriteLocker lock(&_deleteLock);
|
||||||
|
do {
|
||||||
|
delete _overlaysToDelete.takeLast();
|
||||||
|
} while (!_overlaysToDelete.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::init(QGLWidget* parent) {
|
void Overlays::init(QGLWidget* parent) {
|
||||||
|
|
Loading…
Reference in a new issue