Hi Jeff-

Am Fr., 12. Okt. 2018 um 13:46 Uhr schrieb Jeff Young <[email protected]>:

> That doesn’t work because the lock/unlock calls are in separate routines
> (BeginDrawing() and EndDrawing()).
>

Sorry, I was unclear.  There are catches for OpenGL failures that do not
unlock the context if the error thrown is not std::runtime_error.  I
believe that the locking conflict is triggered here where an error is
thrown all the way up to GAL, bypassing the unlock and leading to
deadlock.  Adding a default catch that unlocks the context before
re-throwing would fix that


> That’s fundamentally unsafe, so I’m adding lockContext() and
> unlockContext() protected methods to the GAL API and a GAL_CONTEXT_LOCKER
> friend class that can be created on the stack.  BeginDrawing() will ASSERT
> that the context has indeed been locked.
>

RAII locking is definitely the safest way to go.  Lose the stack->lose the
lock.

-S
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to