Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-07-07 01:21:16 +0400
committerErwin Coumans <blender@erwincoumans.com>2006-07-07 01:21:16 +0400
commit011749eb081950e075a62662653ea0a315bf8d20 (patch)
treef9cfd02b53ff0ae4ade22d14ad26a1d0e25f40a6 /source
parenta156ecb7f5a047b024ae5238718821a678abd414 (diff)
attempt to fix crashes (reported under Linux)related to OpenGL extension queries.
seems to be a known issue, combo of pthreads, dlopen and libGL cannot call dlclose !?! Let's cross the fingers this works...
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
index 9a59668f31a..b609c85dcbe 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
@@ -177,19 +177,30 @@ typedef void (*(*PFNBGLXGETPROCADDRESSARBPROC)(const GLubyte *procname))();
void *_getProcAddress(const GLubyte *procName) { return NULL; }
PFNBGLXGETPROCADDRESSARBPROC bglGetProcAddress;
+
+//weird bug related to combination of pthreads,libGL and dlopen
+//cannot call dlclose in such environment, causes crashes
+//so try to keep a global handle to libGL
+void* libGL = 0;
+
static void bglInitEntryPoints (void)
{
Display *dpy = glXGetCurrentDisplay();
std::vector<STR_String> Xextensions = STR_String(glXQueryExtensionsString(dpy, DefaultScreen(dpy))).Explode(' ');
if (std::find(Xextensions.begin(), Xextensions.end(), "GLX_ARB_get_proc_address") != Xextensions.end())
{
- void *libGL = dlopen("libGL.so", RTLD_LAZY);
- if (libGL)
+ if (!libGL)
{
+ libGL = dlopen("libGL.so", RTLD_GLOBAL);
bglGetProcAddress = (PFNBGLXGETPROCADDRESSARBPROC) (dlsym(libGL, "glXGetProcAddressARB"));
- dlclose(libGL);
+
+ // dlclose(libGL);
if (!bglGetProcAddress)
bglGetProcAddress = (PFNBGLXGETPROCADDRESSARBPROC) _getProcAddress;
+
+ // --
+ if( !libGL && !bglGetProcAddress)
+ std::cout << "Error: " << dlerror() << std::endl;
}
}
}