Page MenuHome

Crash as soon as press material button in properties panel
Closed, ResolvedPublic


Windows 10 64 bits - Compiled source with last version at 20/06/2018 16:00 using MSVSC 2017 Debug mode

To reproduce:

  1. blender --factory-startup
  2. Select material icon in properties panel
  3. Crash

Log details: P733

Doing some debug, the function GPU_texture_bind() is failing because text field is NULL.

The line with error is this:

if (tex->bindcode != 0)

Event Timeline

Philipp Oeser (lichtwerk) triaged this task as Normal priority.

I cannot reproduce (linux 970m, 390.59 drivers)
This has been reported a couple of times btw., see T55541, T55553, T55523, T55567 (I've closed these before because of 2.8 policy)

But I assume this is MacOS/Windows issue?

Seeing @Clément Foucault (fclem) already talking about it in IRC, assigning to him?

The problem is only in Windows and Mac:

Commit 30c383fd35b5184037ba58ed2f7184af39a7b946 works

The commit that introduced the error is this: 8c77c3653996516ba152eade2c27980ae20a1198

Antonio Vazquez (antoniov) raised the priority of this task from Normal to Confirmed, Medium.

Only in Windows and maybe in Mac.

@Clément Foucault (fclem) I'm not sure if this is related, but now I get the same error when press F12 using Eevee. The error is not all the times (maybe 90% of times).

Hmmm then it seems that 8c77c3653996516ba152eade2c27980ae20a1198 is wrong in some way.

There must be some threading issue with the context creation process. Maybe we need some mutex in GHOST for the initialization of the context at least.

LazyDodo (LazyDodo) reopened this task as Open.

It's a classic race condition, here's what's up


  1. main thread: createOffscreenContext (offscreen context is now bound to main thread)
  2. main thread: Start background render.
  3. mainthread redraws ui and calls wglMakeCurrent on the gui context, detaching the offscreencontext from the main thread.
  4. Background Thread: wglMakeCurrent on offscreen context succeeds since it's not bound currently

Render success!

most of the time:

  1. main thread: createOffscreenContext (offscreen context is now bound to main thread)
  2. main thread: Start background render.
  3. Background Thread: wglMakeCurrent on offscreen context fails since it's still bound to the main thread.
  4. mainthread redraws ui and calls wglMakeCurrent on the gui context.
  5. background thread tries to make a texture without an active context, and crashes.

Something like P737 fixes it, but feels kinda hacky (I suppose this might also be an issue on other platforms which this patch doesn't address), @Germano Cavalcante (mano-wii) any opinions here? maybe have make it a requirement that createOffscreenContext restores the context it was on when it was called?

Well my latest refactor in this area was to assure that a context is only made current on the thread that will use it (first time made active in GHOST_ContextWGL::initContext). So maybe I overlooked something.

LazyDodo (LazyDodo) closed this task as Resolved.Jun 23 2018, 7:38 PM

I tried doing the same thing, and that blew up a tiny bit, to share resources the creating thread needs exclusive access to the main context currently bound to the main thread. WM_opengl_context_create has a comment about it, guess i'm not the first one to try and fail at this :)

Think best way forward is have createOffscreenContext create the context, but restore the calling context when it's done. Implemented this in D3499 and F12 , Background renders and the material tab all work now.

Thanks, mac build fixed for me too.

I wanted to report seeing this with the latest build as of 7/8/2018. I used both Windows x64 versions available and consistently saw the same result.

System: Windows 10 Home

Steps to reproduce:

  • Start blender default configuration
  • Select Cube
  • Navigate to the materials tab in properties panel

App would then crash.

macOS : Blender(7/8/2018)

blender --factory-startup
Select Light icon in properties panel

so , what i have to do to fix this Bug??
Crashed when pressing material icon
WIN 10 , 64 B

renderer: 'Quadro 2000M/PCIe/SSE2'
vendor: 'NVIDIA Corporation'
version: '4.5.0 NVIDIA 347.88'