http://bugs.winehq.org/show_bug.cgi?id=34847
Bug #: 34847 Summary: The Swapper 2.0.x (GOG.com) crashes on startup (OpenGL glBindTexture on thread with no active gl context) Product: Wine Version: 1.7.5 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net Classification: Unclassified
Hello folks,
as the summary says... it crashes with managed backtrace.
Prerequisite: 'winetricks -q dotnet40'
Additionally 'winetricks -q gdiplus' is needed to work around bug 31293 ("Multiple .NET apps need GdipPrivateAddFontFile (MTGO v3 launcher, Harmony Practice 3")
Console output:
--- snip --- $ pwd /home/focht/.wine/drive_c/GOG Games/The Swapper ... $ wine ./TheSwapper.exe ... fixme:shell:URL_ParseUrl failed to parse L"Poly2Tri" fixme:shell:URL_ParseUrl failed to parse L"Antlr3.Runtime" fixme:shell:URL_ParseUrl failed to parse L"HackFlipcodeDecomposer" fixme:thread:NtQueryInformationThread info class 16 not supported yet
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at OpenTK.Graphics.OpenGL.GL.Core.BindTexture(TextureTarget target, UInt32 texture) at OpenTK.Graphics.OpenGL.GL.BindTexture(TextureTarget target, Int32 texture) at #=qspupw6aAQRvhz2r1wc647d1$NzZyWbb7974SWlkKFpjJ1VeukGn_wvGCMRx7aBSiWh1iuicIyacRGfVqgBm9Rg==.#=qxG1RzIHGHPuJuQ9DtG4yhQ==(Int32 #=qsSRVY4FmFS4iYRT1PxaVNw==) at FacepalmGames.TrueEngine.Graphics.OpenGL.OpenGL_Texture.Dispose() at #=qULyUf5doESIVBNnEWBr9jN$hFDnWSfTNkblxZVPkoCXVICMIlUf3Oz5uUy69udDx.#=qbCGlUo53gCwDv9X$E_5Iipk92Zlu$dzUi0ZnO80onPs=(Delay #=qVN6KXXzrwp4xa_tgGyT1jQ==) at FacepalmGames.TrueEngine.Delay.Update(Single realDeltatime, Single deltatime) at FacepalmGames.TrueEngine.DelayManager.Update(Single realDeltatime, Single deltatime) at FacepalmGames.TrueEngine.Entities.Scene.#=qcxzqmQNZ7TSahScA1o$Rrw==(Single #=q6De8gKPg5ESl6NuDXrBRcA==, Single #=qaucCZLW9S0zUXSlrUo6iYnnvSSi1tmqip0uXE0QXrwA=, Single #=qqc2gLOtgfcZeiY4LXS3whw==, Single #=qO9TZ3LUfP6bxhsIfL_rR0Z7xK3bfiaKUx1IIuEZVA0E=) at FacepalmGames.TrueEngine.Entities.SceneManager.#=qG1mfX3aU5i$$4RZvkfzUkw==(Single #=qdFIjUqk3WRECcfuHyBXXZA==, Single #=q3QDB3JyyarsE0ZUqbDVMZblSntu_9cgwTl_01PI3pZA=, Single #=qrXUE910DbtLTh2XYLVIrDA==, Single #=qyNuK7AKKIdZJOCkcLFmmipJZCxMqc8TMaiv9w3U2v7c=) at FacepalmGames.TrueEngine.GameStateController.OnUpdateFrame() at FacepalmGames.TrueEngine.UpdateManager.#=qH_xcAJvh9NICLf1lxmJf1g==() at FacepalmGames.TrueEngine.UpdateManager.#=qYThq6FqzXGbBWu3gjG$5Ug==() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() ... --- snip ---
Relevant part of trace log:
--- snip --- $ WINEDEBUG=+tid,+seh,+loaddll,+process,+opengl,+wgl wine ./TheSwapper.exe ... 002b:trace:wgl:glxdrv_wglMakeCurrent (0x30033,0x185ea0) 002b:trace:wgl:describeContext Context 0x185ea0 have (vis:(nil)): 002b:trace:wgl:describeContext - FBCONFIG_ID 0x107 002b:trace:wgl:describeContext - VISUAL_ID 0x24 002b:trace:wgl:glxdrv_wglMakeCurrent hdc 0x30033 drawable 4e00029 fmt 0x188558 ctx 0x7d9d07b0 002b:trace:wgl:glxdrv_wglMakeCurrent 0x30033,0x185ea0 returning 1 ... 002b:trace:opengl:glBindBuffer (34962, 1) 002b:trace:opengl:glBindBuffer (34963, 2) 002b:trace:opengl:glVertexPointer (3, 5126, 24, (nil)) 002b:trace:opengl:glNormalPointer (5126, 24, 0xc) 002b:trace:opengl:glPushMatrix () 002b:trace:opengl:glTranslatef (0.000000, 0.000000, 1000.000000) 002b:trace:opengl:glScalef (10100.000000, 10100.000000, 10100.000000) 002b:trace:opengl:glUseProgram (49) 002b:trace:opengl:glUniform1f (3, 65.000000) 002b:trace:opengl:glUniform1f (2, 64000.000000) 003d:trace:opengl:glBindTexture (3553, 1) 003d:trace:seh:raise_exception code=c0000005 flags=0 addr=0x7e08f55b ip=7e08f55b tid=003d 003d:trace:seh:raise_exception info[0]=00000000 003d:trace:seh:raise_exception info[1]=0000003c 003d:trace:seh:raise_exception eax=00000000 ebx=7e103000 ecx=00000000 edx=0c2aef88 esi=07db0fa0 edi=0c2add74 003d:trace:seh:raise_exception ebp=0c2add60 esp=0c2add20 cs=0023 ds=002b es=002b fs=0063 gs=006b flags=00010206 --- snip ----
Debugger:
--- snip ---- Unhandled exception: page fault on read access to 0x0000003c in 32-bit code (0x7e09b55b). Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b EIP:7e09b55b ESP:07fddd20 EBP:07fddd60 EFLAGS:00010246( R- -- I Z- -P- ) EAX:00000000 EBX:7e10f000 ECX:00000de1 EDX:00000001 ESI:079415e0 EDI:07fddd74 Stack dump: 0x07fddd20: 00090f04 80000000 00000000 07fddd9c 0x07fddd30: 79161f69 00000000 00000000 79161f86 0x07fddd40: 7ffb0000 c02492f8 07fde4dc 00000000 0x07fddd50: 079415e0 00000000 00000000 018bef38 0x07fddd60: 07fdddac 033d4c18 00000de1 00000001 0x07fddd70: c7ecbc88 79145d80 07fde4dc 00000008 000c: sel=0067 base=00000000 limit=00000000 16-bit --x Backtrace: =>0 0x7e09b55b glBindTexture+0x8c(target=0xde1, texture=0x1) [/home/focht/projects/wine/wine-git/dlls/opengl32/opengl_norm.c:65] in opengl32 (0x07fddd60) 1 0x033d4c18 (0x07fdddac) 2 0x033d4b43 (0x07fdddd4) --- snip ----
Disassembly/debugger tells it's crashing because glTable is NULL.
--- snip --- glBindTexture+1B mov [esp+20h], eax glBindTexture+1F mov eax, [esp+20h] glBindTexture+23 mov eax, [eax+0BE8h] ; NtCurrentTeb()->glTable glBindTexture+29 mov [esp+2Ch], eax ... glBindTexture+88 mov eax, [esp+2Ch] ; NtCurrentTeb()->glTable glBindTexture+8C mov eax, [eax+3Ch] ; *boom* funcs->gl.p_glBindTexture glBindTexture+8F mov edx, [ebp+texture] glBindTexture+92 mov [esp+4], edx glBindTexture+96 mov edx, [ebp+target] glBindTexture+99 mov [esp], edx glBindTexture+9C call eax glBindTexture+9E mov ebx, [ebp+var_4] glBindTexture+A1 leave glBindTexture+A2 retn 8 --- snip ---
Source: http://source.winehq.org/git/wine.git/blob/2480c9395b0b9a14ad1747d2c4621e0cd...
--- snip --- 59 /*********************************************************************** 60 * glBindTexture (OPENGL32.@) 61 */ 62 void WINAPI glBindTexture( GLenum target, GLuint texture ) { 63 const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; 64 TRACE("(%d, %d)\n", target, texture ); 65 funcs->gl.p_glBindTexture( target, texture ); 66 } --- snip ---
glBindTexture() is called on a thread (tid 0x3d) with no active OpenGL context. The current context is on tid 0x2b.
Not sure why this gl call happens on a different thread ... maybe it's some asynchronous texture loading in worker thread. Anyway, the log doesn't show wgl "makecurrent" nor creation of a second gl context for the secondary thread.
$ sha1sum setup_the_swapper_2.0.0.2.exe 174e7db9b1d187eac4fb92e94db2712ce69ba614 setup_the_swapper_2.0.0.2.exe
$ du -sh setup_the_swapper_2.0.0.2.exe 722M setup_the_swapper_2.0.0.2.exe
$ wine --version wine-1.7.5-251-gbcf4ded
Regards
http://bugs.winehq.org/show_bug.cgi?id=34847
Adam Bolte boltronics@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |boltronics@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=34847
tomas191191@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tomas191191@gmail.com
--- Comment #1 from tomas191191@gmail.com --- Created attachment 48824 --> http://bugs.winehq.org/attachment.cgi?id=48824 Backtrace
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #2 from tomas191191@gmail.com --- Created attachment 48825 --> http://bugs.winehq.org/attachment.cgi?id=48825 Log file
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #3 from tomas191191@gmail.com --- I installed The Swapper using the GoG installer on Wine 1.7.20 with dotnet40 installed. It crashes with the same error as the bug creator describes. I have attached the backtrace and log file.
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #4 from Bruno Jesus 00cpxxx@gmail.com --- Created attachment 48828 --> http://bugs.winehq.org/attachment.cgi?id=48828 patch
This bug seems similar to bug 36506, does the attached patch help?
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #5 from tomas191191@gmail.com --- (In reply to Bruno Jesus from comment #4)
Created attachment 48828 [details] patch
This bug seems similar to bug 36506, does the attached patch help?
I would try, but since the patch only affects "glGetString" and not "glBindTexture" (which is the failing function in this case) I think it'd be a waste of time. I'm no expert though, so please tell me if I'm wrong.
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #6 from tomas191191@gmail.com --- (In reply to tomas191191 from comment #5)
(In reply to Bruno Jesus from comment #4)
Created attachment 48828 [details] patch
This bug seems similar to bug 36506, does the attached patch help?
I would try, but since the patch only affects "glGetString" and not "glBindTexture" (which is the failing function in this case) I think it'd be a waste of time. I'm no expert though, so please tell me if I'm wrong.
After my hasty reply, I noticed that you attached a patch to your comment. I thought you were talking about the patches attached to the bug you referenced. Please disregard my comment, I will attempt compiling Wine with your patch.
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #7 from tomas191191@gmail.com --- Created attachment 48842 --> http://bugs.winehq.org/attachment.cgi?id=48842 patch 2
makes the game launch and play without further issues
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #8 from tomas191191@gmail.com --- (In reply to Bruno Jesus from comment #4)
Created attachment 48828 [details] patch
This bug seems similar to bug 36506, does the attached patch help?
I applied your patch, but the same error occurred in glDeleteTextures. I copied your changes to that function, and now the game appears to work flawlessly. I've been playing it for around 20 minutes. The patch is attached ("patch 2").
To summarize, Wine 1.7.20 32-bit with "patch 2" applied can play The Swapper flawlessly, assuming you use winetricks to install dotnet40 before installing The Swapper.
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #9 from Bruno Jesus 00cpxxx@gmail.com --- Thanks for testing. I'll try to send the patch for review.
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #10 from tomas191191@gmail.com --- (In reply to Bruno Jesus from comment #9)
Thanks for testing. I'll try to send the patch for review.
I'm curious though, is this a bug in Wine, or is it a bug in The Swapper that just happens to clash with Wine? Because I see hundreds (a rough estimate) of functions in opengl_norm.c that makes the same assumptions that glBindTexture and glDeleteTextures do. Should the error checking be added to all of them too?
http://bugs.winehq.org/show_bug.cgi?id=34847
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
--- Comment #11 from Bruno Jesus 00cpxxx@gmail.com --- (In reply to tomas191191 from comment #10)
I'm curious though, is this a bug in Wine, or is it a bug in The Swapper that just happens to clash with Wine? Because I see hundreds (a rough estimate) of functions in opengl_norm.c that makes the same assumptions that glBindTexture and glDeleteTextures do. Should the error checking be added to all of them too?
According to Anastasius in bug 36506 [1] that is a bad behavior in the application, but since Windows copes with that we need too. If other applications show problems in other functions they can be fixed too but since it seems to be a rare case we do it by demand.
[1] http://bugs.winehq.org/show_bug.cgi?id=36506#c6
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #12 from Bruno Jesus 00cpxxx@gmail.com --- Most likely fixed by http://source.winehq.org/git/wine.git/?a=commit;h=b72c8a7680ad2b5bc1963f63fd...
Please retest in wine-git.
http://bugs.winehq.org/show_bug.cgi?id=34847
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |b72c8a7680ad2b5bc1963f63fd3 | |42f60ab445a41 Status|NEW |RESOLVED URL| |http://www.gog.com/game/the | |_swapper Component|-unknown |opengl Resolution|--- |FIXED
--- Comment #13 from Anastasius Focht focht@gmx.net --- Hello folks,
this is fixed by commit http://source.winehq.org/git/wine.git/commitdiff/b72c8a7680ad2b5bc1963f63fd3...
Thanks Alexandre and Bruno for his efforts.
Only .NET 4.0 Framework client profile in 32-bit WINEPREFIX is needed.
Regards
http://bugs.winehq.org/show_bug.cgi?id=34847
--- Comment #14 from tomas191191@gmail.com --- Built Wine from hash 258942f28f (most recent commit to master at 2014-06-25), The Swapper works without hacks.
https://bugs.winehq.org/show_bug.cgi?id=34847
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #15 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.21.