macOS M2 / Apple Silicon - Threading Freeze with EditorGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 799
Joined: Fri Dec 04, 2015 9:26 pm

macOS M2 / Apple Silicon - Threading Freeze with EditorGadget

Post by skinkairewalker »

I've tested this exact code on an M2 Mac (macOS), and the application just freezes without populating the EditorGadget. However, it works perfectly on Linux ARM and Windows x64. Can anyone else confirm this behavior?

Code: Select all


Enumeration
  #Window_Main
  #Editor_Log
EndEnumeration


Procedure PopulateEditor(Gadget)
  Protected i
  For i = 1 To 100000

    AddGadgetItem(#Editor_Log, -1, "Esta é a string de número: " + Str(i))
  Next i
EndProcedure


If OpenWindow(#Window_Main, 0, 0, 600, 400, "Populando EditorGadget com Thread", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)


  EditorGadget(#Editor_Log, 0, 0, WindowWidth(#Window_Main), WindowHeight(#Window_Main))


  CreateThread(@PopulateEditor(), GadgetID(#Editor_Log))

  Repeat
    Define Event = WaitWindowEvent()

    Select Event

      Case #PB_Event_CloseWindow
        Break
    EndSelect
  ForEver

EndIf
User avatar
Bisonte
Addict
Addict
Posts: 1320
Joined: Tue Oct 09, 2007 2:15 am

Re: macOS M2 / Apple Silicon - Threading Freeze with EditorGadget

Post by Bisonte »

Is it not the same like in Windows ?
Don't manipulate gadgets from another thread as the mainthread ?
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Fred
Administrator
Administrator
Posts: 18349
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: macOS M2 / Apple Silicon - Threading Freeze with EditorGadget

Post by Fred »

Yes you can't do that, you need to use PostEvent()
User avatar
mk-soft
Always Here
Always Here
Posts: 6314
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: macOS M2 / Apple Silicon - Threading Freeze with EditorGadget

Post by mk-soft »

It only worked for you on Linux by chance.
Here, too, no gadgets from threads should be changed.

See Mini Thread Control to change gadgets on threads.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 799
Joined: Fri Dec 04, 2015 9:26 pm

Re: macOS M2 / Apple Silicon - Threading Freeze with EditorGadget

Post by skinkairewalker »

oooooh, awesome
User avatar
Piero
Addict
Addict
Posts: 1040
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: macOS M2 / Apple Silicon - Threading Freeze with EditorGadget

Post by Piero »

See why I'm long-time mk-soft Fan?
Post Reply