From c45a3b80e2356a952248eaafaeeec48b28bcb0fd Mon Sep 17 00:00:00 2001 From: Antonioya Date: Thu, 21 Jun 2018 16:10:52 +0200 Subject: Fix T55555: Crash when select material properties This error is only in Windows and Mac when select in properties the material tab. This commit revert dc856be8399242f4ee3a2ce0450b7ac5a20b35f6 Preview: Add own opengl context to render preview images. --- source/blender/editors/render/render_preview.c | 48 ++------------------------ 1 file changed, 2 insertions(+), 46 deletions(-) (limited to 'source/blender/editors/render') diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index cdd79f43a72..4a3c7a3fd4b 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -176,9 +176,6 @@ typedef struct ShaderPreview { Main *bmain; Main *pr_main; - - void *gl_context; - bool gl_context_owner; } ShaderPreview; typedef struct IconPreviewSize { @@ -194,8 +191,6 @@ typedef struct IconPreview { void *owner; ID *id; ListBase sizes; - - void *gl_context; } IconPreview; /* *************************** Preview for buttons *********************** */ @@ -746,10 +741,6 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs /* set this for all previews, default is react to G.is_break still */ RE_test_break_cb(re, sp, shader_preview_break); - if (sp->gl_context) { - RE_gl_context_set(re, sp->gl_context); - } - /* lens adjust */ oldlens = ((Camera *)sce->camera->data)->lens; if (sizex > sp->sizey) @@ -869,10 +860,6 @@ static void shader_preview_free(void *customdata) } MEM_freeN(sp->lampcopy); } - if (sp->gl_context_owner && sp->gl_context) { - WM_opengl_context_dispose(sp->gl_context); - sp->gl_context = NULL; - } MEM_freeN(sp); } @@ -1088,8 +1075,6 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short sp->pr_rect = cur_size->rect; sp->id = ip->id; sp->bmain = ip->bmain; - sp->gl_context = ip->gl_context; - sp->gl_context_owner = false; if (is_render) { BLI_assert(ip->id); @@ -1106,11 +1091,6 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short common_preview_startjob(sp, stop, do_update, progress); shader_preview_free(sp); } - - if (ip->gl_context) { - WM_opengl_context_dispose(ip->gl_context); - ip->gl_context = NULL; - } } static void icon_preview_endjob(void *customdata) @@ -1194,17 +1174,8 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r /* render all resolutions from suspended job too */ old_ip = WM_jobs_customdata_get(wm_job); - if (old_ip) { + if (old_ip) BLI_movelisttolist(&ip->sizes, &old_ip->sizes); - /* NOTE: This assumes that it will be the same thread - * that will be used when resuming the job. */ - ip->gl_context = old_ip->gl_context; - } - - if (ip->gl_context == NULL) { - /* Create context in the main thread. */ - ip->gl_context = WM_opengl_context_create(); - } /* customdata for preview thread */ ip->bmain = CTX_data_main(C); @@ -1235,7 +1206,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M { Object *ob = CTX_data_active_object(C); wmJob *wm_job; - ShaderPreview *sp, *old_sp; + ShaderPreview *sp; Scene *scene = CTX_data_scene(C); short id_type = GS(id->name); @@ -1252,21 +1223,6 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW); sp = MEM_callocN(sizeof(ShaderPreview), "shader preview"); - /* Reuse previous gl context. */ - old_sp = WM_jobs_customdata_get(wm_job); - if (old_sp) { - /* NOTE: This assumes that it will be the same thread - * that will be used when resuming the job. */ - old_sp->gl_context_owner = false; /* Don't free it */ - sp->gl_context = old_sp->gl_context; - } - - if (sp->gl_context == NULL) { - /* Create context in the main thread. */ - sp->gl_context = WM_opengl_context_create(); - } - sp->gl_context_owner = true; - /* customdata for preview thread */ sp->scene = scene; sp->depsgraph = CTX_data_depsgraph(C); -- cgit v1.2.3