PB x86 on Win 8.1 - driving me crazy
Posted: Fri May 02, 2014 4:41 am
Hi All,
Finally i was able to reproduce what looks to me like a bug (not necessarily in PB!) on a readable scale ... Here is the code:
Here is what is going on:
1. I compile the above with PB 5.22 x86 on Win 8.1 the exe crashes with 0xc0000005 'magical' error
2. I set the compatibility mode of that EXE to Windows 8 or earlier, it runs fine
3. I take that same exe to my win7 pc it just runs fine
4. I run from the IDE PB5.22 x86 it crashes
5. I set the compatibility mode of PB IDE to Windows 8 or earlier, it runs fine
6. I run/compile with PB 5.22 x64 no issue everything is fine! No need to change compatibility mode or anything else
So,
Is it my code ? Is it PB ? Is it Win 8.1 ? Is it my pc ? is it the color of my shirt
Any help is appreciated ( the above needs be compiled with Thread-safe)
Thanks
Said
Finally i was able to reproduce what looks to me like a bug (not necessarily in PB!) on a readable scale ... Here is the code:
Code: Select all
EnableExplicit
Structure TC
S1.s
S2.s
S3.s
Array M.f(0)
F1.f
F2.f
Map mp1.i()
List lst.s()
EndStructure
Structure TH
List lstTCs.TC()
Array AM.i(0)
Array RQ.i(0)
EndStructure
Structure TS
H1.TH
H2.TH
H3.TH
EndStructure
Global S.TS , Event, Counter, Mtx = CreateMutex()
Procedure TC_Init(*C.TC)
ClearStructure(*C, TC)
InitializeStructure(*C, TC)
Dim *C\M( 30 )
*C\F1 = 1.0
EndProcedure
Procedure TC_Copy(*Org.TC, *Dst.TC)
CopyStructure(*Org, *Dst, TC)
EndProcedure
Procedure TH_Init(*H.TH)
ClearStructure(*H, TH)
InitializeStructure(*H, TH)
EndProcedure
Procedure TH_Copy(*Org.TH, *Dst.TH)
CopyStructure(*Org, *Dst, TH)
EndProcedure
Procedure TH_Add_C(*H.TH, *C.TC, Position = -1)
Protected n
n = ListSize(*H\lstTCs())
If Position >= 0 And Position < n
SelectElement(*H\lstTCs(), Position)
InsertElement(*H\lstTCs())
TC_Copy( *C, @*H\lstTCs())
Else
LastElement(*H\lstTCs())
AddElement(*H\lstTCs())
TC_Copy( *C, @*H\lstTCs())
EndIf
EndProcedure
Procedure Fill_H(*S.TS)
Protected C.TC, i, n = 100000
TH_Init(*S\H1)
For i=1 To n
TC_Init(@C)
C\S1 = "A" + Str(i)
C\mp1("123") = 123
AddElement(C\lst()) : C\lst() = "123"
TH_Add_C(*S\H1, @C)
LockMutex(Mtx)
Counter + 1
UnlockMutex(Mtx)
Next
MessageRequester("Done","You can close now")
EndProcedure
If OpenWindow(0, 0, 0, 230, 90, "crash on win 8.1 ...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(1, 10, 10, 200, 25, "Click me")
TextGadget(2, 10, 50, 200, 25, "")
AddWindowTimer(0, 3, 100)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
If EventGadget() = 1
DisableGadget(1, 1)
CreateThread(@Fill_H(), @S)
EndIf
Case #PB_Event_Timer
If EventTimer() = 3
LockMutex(Mtx)
SetGadgetText(2, Str(Counter))
UnlockMutex(Mtx)
EndIf
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
Here is what is going on:
1. I compile the above with PB 5.22 x86 on Win 8.1 the exe crashes with 0xc0000005 'magical' error
2. I set the compatibility mode of that EXE to Windows 8 or earlier, it runs fine
3. I take that same exe to my win7 pc it just runs fine
4. I run from the IDE PB5.22 x86 it crashes
5. I set the compatibility mode of PB IDE to Windows 8 or earlier, it runs fine
6. I run/compile with PB 5.22 x64 no issue everything is fine! No need to change compatibility mode or anything else
So,
Is it my code ? Is it PB ? Is it Win 8.1 ? Is it my pc ? is it the color of my shirt
Any help is appreciated ( the above needs be compiled with Thread-safe)
Thanks
Said