Page 1 of 1

PB5.20bx: WebGadget() and Thread->Invalid memory access

Posted: Mon Jul 01, 2013 5:07 pm
by JJ
Hello,

I find a trouble between previous version of PB and the new PB5.20, with WebGadget() in a thread.

The trouble commes when you launch the thread more one time. The second Thread will crash with the message:"Invalid memory access.(read error at adress 0)" when the thread want to create the WebGadget().

Code: Select all

Structure param
  x.i
  y.i
  order.i
EndStructure  

Procedure WaitWindowEventThread()
  DisableDebugger:ret = WaitWindowEvent():EnableDebugger
  ProcedureReturn ret
EndProcedure

Procedure OpenWindowThread(Window, x, y, InnerWidth, InnerHeight, Title$ , Flags=0 , ParentWindowID=0)
  DisableDebugger
  If flags And ParentWindowID
    ret = OpenWindow(Window, x, y, InnerWidth, InnerHeight, Title$ , Flags , ParentWindowID)
  ElseIf flags
    ret = OpenWindow(Window, x, y, InnerWidth, InnerHeight, Title$ , Flags)
  Else
    ret = OpenWindow(Window, x, y, InnerWidth, InnerHeight, Title$)
  EndIf  
  EnableDebugger
  ProcedureReturn ret
EndProcedure

Procedure WinGadgetThread(*p.param)
  With *p
    Debug "Begin:Thread param:"+Str(\x)+","+Str(\y)
    win1 = OpenWindowThread(#PB_Any, \x, \y, 600, 300, "WebGadget", #PB_Window_SystemMenu )
    Web = WebGadget(#PB_Any, 10, 10, 580, 280, "http://www.google.com") ;<--- Crash in the second Thread:Invalid memory access.(read error at adress 0)
    Repeat
      Delay(1)
    Until WaitWindowEventThread()=#PB_Event_CloseWindow Or \order=1
    CloseWindow(win1)
    Debug "End:Thread param:"+Str(\x)+","+Str(\y)
  EndWith
EndProcedure    

toto.param\order = 0
toto\x = 10:toto\y = 10
T1 = CreateThread(@WinGadgetThread(),@toto)
Delay(2000)
toto\order = 1
While (IsThread(T1)):Wend

toto\order = 0
toto\x = 100:toto\y = 100
CreateThread(@WinGadgetThread(),@toto)
Delay(2000)
toto\order = 1
While (IsThread(t1)):Wend

End

Re: PB5.20bx: WebGadget() and Thread->Invalid memory access

Posted: Mon Feb 15, 2016 2:43 pm
by Fred
Gadget in thread are not supported.