Page 1 of 1

Open PathRequester from thread crash

Posted: Tue May 19, 2015 10:40 am
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.

Re: Open PathRequester from thread crash

Posted: Tue May 19, 2015 10:57 am
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.

Re: Open PathRequester from thread crash

Posted: Tue May 19, 2015 11:00 am
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.

Re: Open PathRequester from thread crash

Posted: Tue May 19, 2015 11:07 am
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.

Re: Open PathRequester from thread crash

Posted: Tue May 19, 2015 11:15 am
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?

Re: Open PathRequester from thread crash

Posted: Tue May 19, 2015 11:29 am
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.

Re: Open PathRequester from thread crash

Posted: Tue May 19, 2015 1:08 pm
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.

Re: Open PathRequester from thread crash

Posted: Tue May 19, 2015 7:53 pm
by kemsky_by
So the problem is that callbacks crash program on MacOSX both x64 and x86.