Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 5d09be1f authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Fixed missing/wrong deregistration of GeometryXdTransferFcuntionEditors when...

Fixed missing/wrong deregistration of GeometryXdTransferFcuntionEditors when their widgets are closed (and hence the GL contexts destroyed)
parent 505b37e3
...@@ -83,8 +83,11 @@ namespace campvis { ...@@ -83,8 +83,11 @@ namespace campvis {
Geometry1DTransferFunction* gtf = static_cast<Geometry1DTransferFunction*>(_transferFunction); Geometry1DTransferFunction* gtf = static_cast<Geometry1DTransferFunction*>(_transferFunction);
gtf->s_geometryCollectionChanged.disconnect(this); gtf->s_geometryCollectionChanged.disconnect(this);
// TODO: this needs to be done, but we can not ensure that GLJobProc is still existant during deconstruction...
//GLJobProc.deregisterContext(_canvas); if (OpenGLJobProcessor::isInited())
GLJobProc.deregisterContext(_canvas);
if (tgt::GlContextManager::isInited())
tgt::GlContextManager::getRef().removeContext(_canvas);
} }
void Geometry1DTransferFunctionEditor::updateWidgetFromProperty() { void Geometry1DTransferFunctionEditor::updateWidgetFromProperty() {
......
...@@ -79,8 +79,11 @@ namespace campvis { ...@@ -79,8 +79,11 @@ namespace campvis {
Geometry2DTransferFunction* gtf = static_cast<Geometry2DTransferFunction*>(_transferFunction); Geometry2DTransferFunction* gtf = static_cast<Geometry2DTransferFunction*>(_transferFunction);
gtf->s_geometryCollectionChanged.disconnect(this); gtf->s_geometryCollectionChanged.disconnect(this);
// TODO: this needs to be done, but we can not ensure that GLJobProc is still existant during deconstruction...
//GLJobProc.deregisterContext(_canvas); if (OpenGLJobProcessor::isInited())
GLJobProc.deregisterContext(_canvas);
if (tgt::GlContextManager::isInited())
tgt::GlContextManager::getRef().removeContext(_canvas);
} }
void Geometry2DTransferFunctionEditor::updateWidgetFromProperty() { void Geometry2DTransferFunctionEditor::updateWidgetFromProperty() {
......
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
namespace campvis { namespace campvis {
OpenGLJobProcessor::OpenGLJobProcessor() OpenGLJobProcessor::OpenGLJobProcessor()
: _currentContext(0)
{ {
_pause = 0; _pause = 0;
_currentContext = 0;
} }
OpenGLJobProcessor::~OpenGLJobProcessor() { OpenGLJobProcessor::~OpenGLJobProcessor() {
...@@ -77,8 +77,8 @@ namespace campvis { ...@@ -77,8 +77,8 @@ namespace campvis {
tbb::concurrent_hash_map<tgt::GLCanvas*, PerContextJobQueue*>::const_accessor a; tbb::concurrent_hash_map<tgt::GLCanvas*, PerContextJobQueue*>::const_accessor a;
if (!_contextQueueMap.find(a, context)) { if (!_contextQueueMap.find(a, context)) {
tgtAssert(false, "Should not reach this: Did not find context in contextQueueMap!"); //tgtAssert(false, "Should not reach this: Did not find context in contextQueueMap!");
break; continue;
} }
// avoid expensive context-switches for contexts without pending jobs. // avoid expensive context-switches for contexts without pending jobs.
...@@ -214,11 +214,14 @@ namespace campvis { ...@@ -214,11 +214,14 @@ namespace campvis {
} }
void OpenGLJobProcessor::deregisterContext(tgt::GLCanvas* context) { void OpenGLJobProcessor::deregisterContext(tgt::GLCanvas* context) {
tbb::concurrent_hash_map<tgt::GLCanvas*, PerContextJobQueue*>::const_accessor a; tbb::concurrent_hash_map<tgt::GLCanvas*, PerContextJobQueue*>::accessor a;
if (_contextQueueMap.find(a, context)) { if (_contextQueueMap.find(a, context)) {
delete a->second; delete a->second;
_contextQueueMap.erase(a); _contextQueueMap.erase(a);
} }
if (_currentContext == context)
_currentContext.compare_and_swap(0, context);
} }
tgt::GLCanvas* OpenGLJobProcessor::iKnowWhatImDoingGetArbitraryContext() { tgt::GLCanvas* OpenGLJobProcessor::iKnowWhatImDoingGetArbitraryContext() {
......
...@@ -183,7 +183,7 @@ namespace campvis { ...@@ -183,7 +183,7 @@ namespace campvis {
tbb::atomic<int> _pause; tbb::atomic<int> _pause;
std::condition_variable _evaluationCondition; ///< conditional wait to be used when there are currently no jobs to process std::condition_variable _evaluationCondition; ///< conditional wait to be used when there are currently no jobs to process
tgt::GLCanvas* _currentContext; ///< current active OpenGL context tbb::atomic<tgt::GLCanvas*> _currentContext; ///< current active OpenGL context
}; };
} }
......
...@@ -21,6 +21,7 @@ namespace tgt { ...@@ -21,6 +21,7 @@ namespace tgt {
GLCanvas* GlContextManager::getContextByKey(const std::string& key) { GLCanvas* GlContextManager::getContextByKey(const std::string& key) {
tbb::mutex::scoped_lock lock(_localMutex);
std::map<std::string, GLCanvas*>::iterator it = _contexts.find(key); std::map<std::string, GLCanvas*>::iterator it = _contexts.find(key);
if (it != _contexts.end()) if (it != _contexts.end())
return it->second; return it->second;
...@@ -42,7 +43,7 @@ namespace tgt { ...@@ -42,7 +43,7 @@ namespace tgt {
void GlContextManager::releaseCurrentContext() { void GlContextManager::releaseCurrentContext() {
if (_currentContext != 0) if (_currentContext != 0)
glFinish(); glFinish();
setCurrent(0); setCurrent(0);
} }
...@@ -78,5 +79,16 @@ namespace tgt { ...@@ -78,5 +79,16 @@ namespace tgt {
setCurrent(context); setCurrent(context);
} }
void GlContextManager::removeContext(GLCanvas* context) {
_currentContext = 0;
tbb::mutex::scoped_lock lock(_localMutex);
for (std::map<std::string, GLCanvas*>::iterator it = _contexts.begin(); it != _contexts.end(); ++it) {
if (it->second == context) {
_contexts.erase(it);
break;
}
}
}
} }
...@@ -65,6 +65,13 @@ namespace tgt { ...@@ -65,6 +65,13 @@ namespace tgt {
const ivec2& size = ivec2(GLCanvas::DEFAULT_WINDOW_WIDTH, GLCanvas::DEFAULT_WINDOW_HEIGHT), const ivec2& size = ivec2(GLCanvas::DEFAULT_WINDOW_WIDTH, GLCanvas::DEFAULT_WINDOW_HEIGHT),
const GLCanvas::Buffers buffers = GLCanvas::RGBADD, const GLCanvas::Buffers buffers = GLCanvas::RGBADD,
bool shared = true) = 0; bool shared = true) = 0;
/**
* Removes the OpenGL context \a context from the list of managed contexts.
* \param context Context to remove.
*/
virtual void removeContext(GLCanvas* context);
/** /**
* Returns the OpenGL context with the given key \a key, 0 if no such context exists. * Returns the OpenGL context with the given key \a key, 0 if no such context exists.
...@@ -109,7 +116,9 @@ namespace tgt { ...@@ -109,7 +116,9 @@ namespace tgt {
std::map<std::string, GLCanvas*> _contexts; ///< Map of all OpenGL contexts std::map<std::string, GLCanvas*> _contexts; ///< Map of all OpenGL contexts
GLCanvas* _currentContext; ///< Current active OpenGL context GLCanvas* _currentContext; ///< Current active OpenGL context
tbb::mutex _glMutex; ///< Mutex protecting OpenGL for multi-threaded access tbb::mutex _glMutex; ///< Mutex protecting OpenGL for multi-threaded access
tbb::mutex _localMutex; ///< local mutex to prodect _contexts
static GlContextManager* singletonClass_; static GlContextManager* singletonClass_;
}; };
......
...@@ -18,6 +18,7 @@ namespace tgt { ...@@ -18,6 +18,7 @@ namespace tgt {
// FIXME: rethink this concept of unique IDs // FIXME: rethink this concept of unique IDs
//tgtAssert(_contexts.find(key) == _contexts.end(), "A context with the same key already exists!"); //tgtAssert(_contexts.find(key) == _contexts.end(), "A context with the same key already exists!");
tbb::mutex::scoped_lock localLock(_localMutex);
tbb::mutex::scoped_lock lock(_glMutex); tbb::mutex::scoped_lock lock(_glMutex);
QtThreadedCanvas* toReturn = new QtThreadedCanvas(title, size, buffers, 0, shared); QtThreadedCanvas* toReturn = new QtThreadedCanvas(title, size, buffers, 0, shared);
_contexts.insert(std::make_pair(key, toReturn)); _contexts.insert(std::make_pair(key, toReturn));
......
...@@ -43,12 +43,12 @@ namespace campvis { ...@@ -43,12 +43,12 @@ namespace campvis {
VirtualMirrorGeometryGenerator::VirtualMirrorGeometryGenerator() VirtualMirrorGeometryGenerator::VirtualMirrorGeometryGenerator()
: AbstractProcessor() : AbstractProcessor()
, p_mirrorID("geometryID", "Output Geometry ID", "mirror", DataNameProperty::WRITE) , p_mirrorID("geometryID", "Output Geometry ID", "mirror", DataNameProperty::WRITE)
, p_mirrorCenter("mirrorCenter", "Mirror Center", tgt::vec3(1.f), tgt::vec3(-100.f), tgt::vec3(100.f), tgt::vec3(0.1f)) , p_mirrorCenter("mirrorCenter", "Mirror Center", tgt::vec3(1.f), tgt::vec3(-1000.f), tgt::vec3(1000.f), tgt::vec3(0.1f))
, p_mirrorNormal("mirrorNormal", "Mirror Normal", tgt::vec3(0.f, 1.f, 0.f), tgt::vec3(-1.f), tgt::vec3(1.f), , p_mirrorNormal("mirrorNormal", "Mirror Normal", tgt::vec3(0.f, 1.f, 0.f), tgt::vec3(-1.f), tgt::vec3(1.f),
tgt::vec3(0.001f), tgt::ivec3(3), AbstractProcessor::VALID) tgt::vec3(0.001f), tgt::ivec3(3), AbstractProcessor::VALID)
, p_size("mirrorSize", "Mirror Size", 4.0f, 0.1f, 1000.0f, 0.1f) , p_size("mirrorSize", "Mirror Size", 4.0f, 0.1f, 1000.0f, 0.1f)
, p_numVertices("Roundness", "Roundness", 16, 4, 128) , p_numVertices("Roundness", "Roundness", 16, 4, 128)
, p_poi("poi", "Point of Interest", tgt::vec3::zero, tgt::vec3(-100.f), tgt::vec3(1000.f), tgt::vec3(0.1f)) , p_poi("poi", "Point of Interest", tgt::vec3::zero, tgt::vec3(-100.f), tgt::vec3(100.f), tgt::vec3(0.1f))
, p_camera("camera", "Camera") , p_camera("camera", "Camera")
{ {
addProperty(&p_mirrorID); addProperty(&p_mirrorID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment