Bug 105162 - OPENGL: Crash when trying to drag some text in Writer
Summary: OPENGL: Crash when trying to drag some text in Writer
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: All Windows (All)
: high critical
Assignee: Not Assigned
URL:
Whiteboard: target:5.4.0
Keywords: bibisectRequest, haveBacktrace, regression
Depends on:
Blocks: VCL-OpenGL
  Show dependency treegraph
 
Reported: 2017-01-07 09:24 UTC by Telesto
Modified: 2017-04-06 07:43 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Backtrace with WinDbg (7.26 KB, text/plain)
2017-01-12 20:04 UTC, Aron Budea
Details
Patch that needs more work (1.63 KB, application/mbox)
2017-04-04 08:50 UTC, How can I remove my account?
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2017-01-07 09:24:01 UTC
Description:
LibO crashes when trying to drag text with OpenGL enabled

Steps to Reproduce:
1. Open Writer
2. Add a line of text: for example 'ABC'
3. Select the text and try to drag it

Actual Results:  
Crash

Expected Results:
No crash


Reproducible: Always

User Profile Reset: No

Additional Info:
Found in
Version: 5.4.0.0.alpha0+
Build ID: 92a1ad1f36b6d3cc13135a8c0805508933011577
CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-01-06_23:42:59
Locale: nl-NL (nl_NL); Calc: CL

but not in
Version: 5.3.0.0.alpha1+
Build ID: 43b5ca69aa545cf93eded55258d92d651917815f
CPU Threads: 4; OS Version: Windows 6.2; UI Render: GL; Layout Engine: new; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-11-18_05:27:05
Locale: nl-NL (nl_NL); Calc: CL


User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Comment 1 Aron Budea 2017-01-12 20:04:13 UTC
Created attachment 130375 [details]
Backtrace with WinDbg

Confirmed.

Version: 5.4.0.0.alpha0+
Build ID: db4badfc971b9cc60809c3408f579bae04a77c34
CPU Threads: 4; OS Version: Windows 6.1; UI Render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-01-10_23:25:07
Locale: hu-HU (hu_HU); Calc: CL
Comment 2 Xisco Faulí 2017-01-18 14:12:23 UTC
@Aron, is it possible to bisect this one?
Comment 3 Aron Budea 2017-01-18 16:05:17 UTC
Not reproducible in 5.3.0.2 / Windows 7, so the change hasn't been backported (yet). For the better I guess.
Comment 4 Aron Budea 2017-01-20 03:03:29 UTC
Buovjaga, Xisco, could either of you check if this occurs in Linux, or it's Windows-only?
It's still reproducible with the below daily build.

Version: 5.4.0.0.alpha0+
Build ID: bbf40e3b5d06bd1437b097ed2703179026d1e871
CPU Threads: 4; OS Version: Windows 6.1; UI Render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-01-19_01:45:05
Locale: hu-HU (hu_HU); Calc: CL
Comment 5 Buovjaga 2017-01-20 06:37:43 UTC
OpenGL doesn't work for me on Linux.
Comment 6 Aron Budea 2017-01-20 18:20:48 UTC
Tomaz tested in Linux with a recent master build, no crash. Setting OS to Windows.
Comment 7 Aron Budea 2017-04-04 08:13:44 UTC
Caolán, since the crash is in epoxy, do you think it could be related to the glew -> epoxy change? If so, could you please take a look? (it's a Windows-only crash, which might be less convenient)

Bibisect pointed to a huge range of ~850 commits (builds failed inside that range):
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=aabc5aab5af27e929a81a6036d2f470ab1f5ac4d..3e973760b788c49396c7a18404bffa0505e65a04
Comment 8 How can I remove my account? 2017-04-04 08:34:37 UTC
Here is a stack trace from a bit of debugging:

>	00000000()	Unknown
 	[Frames below may be incorrect and/or missing]	
 	epoxy.dll!epoxy_wglMakeCurrent_unwrapped_dispatch_table_thunk(HDC__ * hDc, HGLRC__ * newContext) Line 1520	C
 	epoxy.dll!epoxy_wglMakeCurrent_wrapped(HDC__ * hdc, HGLRC__ * hglrc) Line 147	C
 	vcllo.dll!WinOpenGLContext::makeCurrent() Line 100	C++
 	vcllo.dll!OpenGLContext::getVCLContext(bool bMakeIfNecessary) Line 522	C++
 	vcllo.dll!OpenGLSalGraphicsImpl::AcquireContext(bool bForceCreate) Line 116	C++
 	vcllo.dll!OpenGLSalGraphicsImpl::InitializePreDrawState(OpenGLSalGraphicsImpl::XOROption eOpt) Line 213	C++
 	vcllo.dll!OpenGLSalGraphicsImpl::PreDraw(OpenGLSalGraphicsImpl::XOROption eOpt) Line 205	C++
 	vcllo.dll!OpenGLSalGraphicsImpl::invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) Line 1773	C++
 	vcllo.dll!WinSalGraphics::invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) Line 231	C++
 	vcllo.dll!SalGraphics::Invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags, const OutputDevice * pOutDev) Line 621	C++
 	vcllo.dll!OutputDevice::Invert(const tools::Rectangle & rRect, InvertFlags nFlags) Line 165	C++
 	vcllo.dll!ImplCursorInvert(ImplCursorData * pData) Line 124	C++
 	vcllo.dll!vcl::Cursor::ImplRestore() Line 160	C++
 	vcllo.dll!vcl::Cursor::ImplDoHide(bool bSuspend) Line 217	C++
 	vcllo.dll!vcl::Cursor::ImplHide() Line 234	C++
 	vcllo.dll!vcl::Cursor::Hide() Line 330	C++
 	swlo.dll!SwVisibleCursor::Hide() Line 112	C++
 	swlo.dll!SwCursorShell::UnSetVisibleCursor() Line 909	C++
 	swlo.dll!SwEditWin::DropCleanup() Line 167	C++
 	swlo.dll!SwEditWin::DragFinished() Line 147	C++
 	swlo.dll!SwTransferable::DragFinished(char nAction) Line 3213	C++
 	svtlo.dll!TransferableHelper::dragDropEnd(const com::sun::star::datatransfer::dnd::DragSourceDropEvent & rDSDE) Line 453	C++
 	dnd.dll!SourceContext::fire_dragDropEnd(bool success, char effect) Line 101	C++
 	dnd.dll!DndOleSTAFunc(void * pParams) Line 352	C++
 	[External Code]	
This is in a separate DnD thread, so possibly the dispatch_table thread-local variable stuff in epoxy is not set up properly for that thread or something? Won't do any more debugging for now.
Comment 9 How can I remove my account? 2017-04-04 08:50:24 UTC
Created attachment 132320 [details]
Patch that needs more work

Actually, just after writing that, I had an idea what might fix it, and it worked. The patch needs some more work, though; presumably we can't call epoxy_handle_external_wglMakeCurrent() unconditionally like that, but need to do it only if we are actually using OpenGL.
Comment 10 Commit Notification 2017-04-04 09:59:24 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f1e2c030b09d25a285d6a206297f0ef7526ccc4a

tdf#105162: Need to call epoxy_handle_external_wglMakeCurrent()

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2017-04-04 10:55:47 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a29f494326b3ed8eba809131b799b649e88b9b85

Revert "tdf#105162: Need to call epoxy_handle_external_wglMakeCurrent()"

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2017-04-04 10:56:37 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d226cfacfd66d5c81d37f707b95f318efe32e5ba

tdf#105162: Need to call epoxy_handle_external_wglMakeCurrent()

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Aron Budea 2017-04-05 22:47:20 UTC
I can confirm crash is gone with 5.4 master build (5f282c101a644ffc3615c3dc43ddb99febecae16).
Comment 14 Michael Meeks 2017-04-06 07:43:49 UTC
Great; thanks for the fix Tor =)