Deadlock opening 3D viewer (lp:#1792173)

[Original report](https://bugs.launchpad.net/bugs/1792173) created by **Jeff Young (jeyjey)**
```
Current master (5.1).  Open board.  Open 3D viewer.  Hang.

__psynch_mutexwait 0x00007fff64c67a46
_pthread_mutex_lock_wait 0x00007fff64e2fb9d
_pthread_mutex_lock_slow 0x00007fff64e2d4c8
boost::interprocess::ipcdetail::posix_mutex::lock() mutex.hpp:96
boost::interprocess::interprocess_mutex::lock() interprocess_mutex.hpp:170
GL_CONTEXT_MANAGER::LockCtx(wxGLContext*, wxGLCanvas*)
gl_context_mgr.cpp:90
KIGFX::OPENGL_GAL::BeginUpdate() opengl_gal.cpp:500
KIGFX::VIEW::UpdateItems() view.cpp:1395
EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) draw_panel_gal.cpp:168
wxAppConsoleBase::HandleEvent(wxEvtHandler*, void
(wxEvtHandler::*)(wxEvent&), wxEvent&) const appbase.cpp:611
wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&,
wxEvent&) const appbase.cpp:623
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) event.cpp:1395
wxEvtHandler::SearchDynamicEventTable(wxEvent&) event.cpp:1754
wxEvtHandler::TryHereOnly(wxEvent&) event.cpp:1588
wxEvtHandler::TryBeforeAndHere(wxEvent&) event.h:3680
wxEvtHandler::ProcessEventLocally(wxEvent&) event.cpp:1525
wxEvtHandler::ProcessEvent(wxEvent&) event.cpp:1498
wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) scrlwing.cpp:252
wxEvtHandler::SafelyProcessEvent(wxEvent&) event.cpp:1616
wxWindowBase::HandleWindowEvent(wxEvent&) const wincmn.cpp:1525
wxWindow::MacDoRedraw(long) window_osx.cpp:2130
wxWidgetCocoaImpl::drawRect(void*, NSView*, void*) window.mm:1650
wxOSX_drawRect(NSView*, objc_selector*, CGRect) window.mm:1140
_NSViewDrawRect 0x00007fff3ab1ff29
-[NSView _drawRect:clip:] 0x00007fff3a3b873c
-[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
0x00007fff3a3b7598
-[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
0x00007fff3a3b6ec5
-[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
0x00007fff3a3b6ec5
-[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
0x00007fff3a3b5ddb
-[NSView
_oldDisplayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
0x00007fff3ab214e0
-[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
0x00007fff3a3b4e5d
-[NSView displayIfNeeded] 0x00007fff3a3b10b4
-[NSWindow displayIfNeeded] 0x00007fff3a3b0a52
___NSWindowGetDisplayCycleObserver_block_invoke.5902 0x00007fff3ab5160d
__37+[NSDisplayCycle currentDisplayCycle]_block_invoke 0x00007fff3a3b055e
CA::Transaction::run_commit_handlers(CATransactionPhase) 0x00007fff480478c7
CA::Transaction::commit() 0x00007fff48046389
_NSTryRunModal 0x00007fff3ab371fb
-[NSAlert runModal] 0x00007fff3a516609
wxMessageDialog::ShowModal() msgdlg.mm:161
wxMessageBox(wxString const&, wxString const&, long, wxWindow*, int, int)
utilscmn.cpp:1375
wxGUIAppTraitsBase::ShowAssertDialog(wxString const&) appcmn.cpp:475
ShowAssertDialog(wxString const&, int, wxString const&, wxString const&,
wxString const&, wxAppTraits*) appbase.cpp:1306
wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*,
wchar_t const*, wchar_t const*) appbase.cpp:785
wxDefaultAssertHandler(wxString const&, int, wxString const&, wxString
const&, wxString const&) appbase.cpp:1096
wxOnAssert(char const*, int, char const*, char const*, char const*)
appbase.cpp:1173
CINFO3D_VISU::GetCircleCorrectionFactor(int) const cinfo3d_visu.cpp:265
CINFO3D_VISU::createLayers(REPORTER*) create_layer_items.cpp:503
CINFO3D_VISU::InitSettings(REPORTER*) cinfo3d_visu.cpp:437
C3D_RENDER_OGL_LEGACY::reload(REPORTER*)
c3d_render_createscene_ogl_legacy.cpp:352
C3D_RENDER_OGL_LEGACY::Redraw(bool, REPORTER*)
c3d_render_ogl_legacy.cpp:481
EDA_3D_CANVAS::OnPaint(wxPaintEvent&) eda_3d_canvas.cpp:391
wxAppConsoleBase::HandleEvent(wxEvtHandler*, void
(wxEvtHandler::*)(wxEvent&), wxEvent&) const appbase.cpp:611
wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&,
wxEvent&) const appbase.cpp:623
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) event.cpp:1395
wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) event.cpp:1001
wxEvtHandler::TryHereOnly(wxEvent&) event.cpp:1592
wxEvtHandler::TryBeforeAndHere(wxEvent&) event.h:3680
wxEvtHandler::ProcessEventLocally(wxEvent&) event.cpp:1525
wxEvtHandler::ProcessEvent(wxEvent&) event.cpp:1498
wxEvtHandler::ProcessPendingEvents() event.cpp:1362
wxAppConsoleBase::ProcessPendingEvents() appbase.cpp:520
wxCFEventLoop::CommonModeObserverCallBack(__CFRunLoopObserver*, int)
evtloop_cf.cpp:98
wxCFEventLoop::OSXCommonModeObserverCallBack(__CFRunLoopObserver*, int,
void*) evtloop_cf.cpp:75
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
0x00007fff3ccf4417
__CFRunLoopDoObservers 0x00007fff3ccf433f
__CFRunLoopRun 0x00007fff3ccd68b8
CFRunLoopRunSpecific 0x00007fff3ccd6153
RunCurrentEventLoopInMode 0x00007fff3bfc0d96
ReceiveNextEventCommon 0x00007fff3bfc0a0f
_BlockUntilNextEventMatchingListInModeWithFilter 0x00007fff3bfc0884
_DPSNextEvent 0x00007fff3a271a73
-[NSApplication(NSEvent)
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] 0x00007fff3aa07e34
-[NSApplication run] 0x00007fff3a266885
wxGUIEventLoop::OSXDoRun() evtloop.mm:300
wxCFEventLoop::DoRun() evtloop_cf.cpp:340
wxEventLoopBase::Run() evtloopcmn.cpp:78
wxAppConsoleBase::MainLoop() appbase.cpp:334
wxAppConsoleBase::OnRun() appbase.cpp:259
wxAppBase::OnRun() appcmn.cpp:304
wxApp::OnRun() app.cpp:922
APP_KICAD::OnRun() kicad.cpp:256
wxEntry(int&, wchar_t**) init.cpp:506
wxEntry(int&, char**) init.cpp:518
main kicad.cpp:287
start 0x00007fff64b17015
```

Story points: 6.0