setDefaultButtonCell crashes in Thread-save

Mac OSX specific forum
Wolfram
Enthusiast
Enthusiast
Posts: 610
Joined: Thu May 30, 2013 4:39 pm

setDefaultButtonCell crashes in Thread-save

Post by Wolfram »

Can someone tell me why this code freeze if I type a view Letters in the StringGadget?
This is happened in Thread-save mode only and with the "setDefaultButtonCell".

Code: Select all

Window  = OpenWindow(#PB_Any,0,0,400,160, "", #PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_ScreenCentered)

OKButton  = ButtonGadget(#PB_Any, WindowWidth(Window) - 70, WindowHeight(Window) - 30, 60, 25, "OK")
ESCButton = ButtonGadget(#PB_Any, 10, WindowHeight(Window) - 30, 100, 25, "Cancel")
 
 
 ButtonCell = CocoaMessage(0,GadgetID(OKButton),"cell")
;     CocoaMessage(0,GadgetID(OKKnopf),"setBezelStyle:", #NSRoundedBezelStyle)
 CocoaMessage(0,WindowID(Window),"setDefaultButtonCell:", ButtonCell)
 
 InputString = StringGadget(#PB_Any,140,WindowHeight(Window) - 80, 118, 20,"")
 
 
 Repeat
   
   event = WaitWindowEvent()
   
   Select event
     Case #PB_Event_CloseWindow
       Exit = #True
   EndSelect
   
 Until Exit = #True
macOS Catalina 10.15.7
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: setDefaultButtonCell crashes in Thread-save

Post by wilbert »

Wolfram wrote:Can someone tell me why this code freeze if I type a view Letters in the StringGadget?
This is happened in Thread-save mode only and with the "setDefaultButtonCell".
Your code seems to work fine here.
Windows (x64)
Raspberry Pi OS (Arm64)
Wolfram
Enthusiast
Enthusiast
Posts: 610
Joined: Thu May 30, 2013 4:39 pm

Re: setDefaultButtonCell crashes in Thread-save

Post by Wolfram »

Hi Wilbert,

type a view letters and delete them with backspace, then repeat this a view times.
It will crash!

I tried it on three machines. OSX 10.6.8, 10.7.5 and 10.9.4.
macOS Catalina 10.15.7
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: setDefaultButtonCell crashes in Thread-save

Post by wilbert »

I tried PB 5.31 (x64) and 5.24(x86) on OS X 10.10.3 and I can't get it to crash.
Windows (x64)
Raspberry Pi OS (Arm64)
Wolfram
Enthusiast
Enthusiast
Posts: 610
Joined: Thu May 30, 2013 4:39 pm

Re: setDefaultButtonCell crashes in Thread-save

Post by Wolfram »

Can someone else verify it?
And don't forget to turn on the Thread-save option.

Thanks
macOS Catalina 10.15.7
User avatar
mk-soft
Always Here
Always Here
Posts: 6554
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: setDefaultButtonCell crashes in Thread-save

Post by mk-soft »

PB 5.31 (x64) and 5.24(x64) on OS X 10.10.3

no crash her
My Projects EventDesigner V3 / ThreadToGUI / OOP-BaseClass / Windows: Module ActiveScript
PB v3.30 / v5.75 - OS Mac Mini - VM Window Pro / Linux Ubuntu
Downloads on my OneDrive
Post Reply