Open PathRequester from thread crash

Just starting out? Need help? Post your questions and find answers here.
kemsky_by
User
User
Posts: 14
Joined: Sun Jul 24, 2011 9:35 pm

Open PathRequester from thread crash

Post by kemsky_by »

Using PathRequester from thread, fisrt time it works, second time program crashes. Purebasic 5.31 x86 and x64, MacOSX 10.9.5. If i call PathRequester from main thread it works fine.
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 543
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Re: Open PathRequester from thread crash

Post by bbanelli »

kemsky_by wrote:Using PathRequester from thread, fisrt time it works, second time program crashes. Purebasic 5.31 x86 and x64, MacOSX 10.9.5. If i call PathRequester from main thread it works fine.
You can't do it from either Linux or OS X, including other window manipulation or requester calls.

Use Bind/Post event for such errands instead.
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
Wolfram
Enthusiast
Enthusiast
Posts: 568
Joined: Thu May 30, 2013 4:39 pm

Re: Open PathRequester from thread crash

Post by Wolfram »

kemsky_by wrote:Using PathRequester from thread, fisrt time it works, second time program crashes. Purebasic 5.31 x86 and x64, MacOSX 10.9.5. If i call PathRequester from main thread it works fine.
You must send a PostEvent() to the MainWindow loop and open it from there.
Don't do any GUI operations directly inside a thread.
macOS Catalina 10.15.7
kemsky_by
User
User
Posts: 14
Joined: Sun Jul 24, 2011 9:35 pm

Re: Open PathRequester from thread crash

Post by kemsky_by »

Wolfram wrote:You must send a PostEvent() to the MainWindow loop and open it from there.
Don't do any GUI operations directly inside a thread.
That's what i did as a quick fix, but it blocks event loop and i have to create my own PathRequester that does not block... which is not fine.
Wolfram
Enthusiast
Enthusiast
Posts: 568
Joined: Thu May 30, 2013 4:39 pm

Re: Open PathRequester from thread crash

Post by Wolfram »

kemsky_by wrote:
Wolfram wrote:You must send a PostEvent() to the MainWindow loop and open it from there.
Don't do any GUI operations directly inside a thread.
That's what i did as a quick fix, but it blocks event loop and i have to create my own PathRequester that does not block... which is not fine.
can you give me an example of you code?
macOS Catalina 10.15.7
kemsky_by
User
User
Posts: 14
Joined: Sun Jul 24, 2011 9:35 pm

Re: Open PathRequester from thread crash

Post by kemsky_by »

PathRequester is blocking call on windows, so if it is opened within event loop - it will stop processing events until user selects smth. Now i'm trying to use callbacks (BindEvent) to avoid blocking, but i got crash if window is closed from callback(and immediate crash if i try to open PathREquester from callback) on MacOSX 10.9.5 and i think it is the same story. I'm using modules.

---

tried latest build from official website - callbacks are totally unusable. Threadsafe, unicode, line numbering, x64 and x86, modules.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Open PathRequester from thread crash

Post by wilbert »

As far as I understand a PathRequester is supposed to be a modal dialog that blocks things.
If you don't want that, maybe you can use an ExplorerComboGadget instead.
Windows (x64)
Raspberry Pi OS (Arm64)
kemsky_by
User
User
Posts: 14
Joined: Sun Jul 24, 2011 9:35 pm

Re: Open PathRequester from thread crash

Post by kemsky_by »

So the problem is that callbacks crash program on MacOSX both x64 and x86.
Post Reply