forked from enlightenment/efl
evas-gl_cocoa: fix crashes at engine startup
Recently, the gl_cocoa engine started to crash at startup. glGetIntegerv() in gl_common was called without any gl context, and therefore segfaulted. We now make sure it is called after a gl context has been created and used. Thanks jpeg for troubleshooting. Fixes T4402
This commit is contained in:
parent
a71b688b10
commit
84679d3173
|
@ -1304,12 +1304,6 @@ eng_image_load_error_get(void *data EINA_UNUSED, void *image)
|
||||||
return im->im->cache_entry.load_error;
|
return im->im->cache_entry.load_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
|
||||||
_dlsym(const char *sym)
|
|
||||||
{
|
|
||||||
return dlsym(RTLD_DEFAULT, sym);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
module_open(Evas_Module *em)
|
module_open(Evas_Module *em)
|
||||||
{
|
{
|
||||||
|
@ -1396,7 +1390,6 @@ module_open(Evas_Module *em)
|
||||||
glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
|
glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
|
||||||
|
|
||||||
LINK2GENERIC(evas_gl_symbols);
|
LINK2GENERIC(evas_gl_symbols);
|
||||||
glsym_evas_gl_symbols(_dlsym);
|
|
||||||
|
|
||||||
/* now advertise out own api */
|
/* now advertise out own api */
|
||||||
em->functions = (void *)(&func);
|
em->functions = (void *)(&func);
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "evas_gl_common.h"
|
#include "evas_gl_common.h"
|
||||||
#include "Evas_Engine_GL_Cocoa.h"
|
#include "Evas_Engine_GL_Cocoa.h"
|
||||||
|
|
||||||
|
extern Evas_Gl_Symbols glsym_evas_gl_symbols;
|
||||||
|
|
||||||
extern int _evas_engine_gl_cocoa_log_dom;
|
extern int _evas_engine_gl_cocoa_log_dom;
|
||||||
|
|
||||||
#ifdef ERR
|
#ifdef ERR
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include "evas_engine.h"
|
#include "evas_engine.h"
|
||||||
|
|
||||||
|
@ -76,6 +77,12 @@ static NSOpenGLContext *_evas_gl_cocoa_shared_context = NULL;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_dlsym(const char *sym)
|
||||||
|
{
|
||||||
|
return dlsym(RTLD_DEFAULT, sym);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Evas_GL_Cocoa_Window *
|
Evas_GL_Cocoa_Window *
|
||||||
eng_window_new(void *window,
|
eng_window_new(void *window,
|
||||||
|
@ -92,6 +99,8 @@ eng_window_new(void *window,
|
||||||
gw->view = [[EvasGLView alloc] initWithFrame:NSMakeRect(0,0,w,h)];
|
gw->view = [[EvasGLView alloc] initWithFrame:NSMakeRect(0,0,w,h)];
|
||||||
NSOpenGLContext *ctx = [(NSOpenGLView*)gw->view openGLContext];
|
NSOpenGLContext *ctx = [(NSOpenGLView*)gw->view openGLContext];
|
||||||
[ctx makeCurrentContext];
|
[ctx makeCurrentContext];
|
||||||
|
|
||||||
|
glsym_evas_gl_symbols(_dlsym);
|
||||||
gw->gl_context = evas_gl_common_context_new();
|
gw->gl_context = evas_gl_common_context_new();
|
||||||
|
|
||||||
if (!gw->gl_context)
|
if (!gw->gl_context)
|
||||||
|
|
Loading…
Reference in New Issue