Opened 4 years ago
Last modified 2 years ago
#16284 new bug
Scripting messages sent to window that not started message loop cause freeze or timeout
Reported by: | X512 | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | Kits/Interface Kit | Version: | R1/Development |
Keywords: | scripting | Cc: | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
This is hrev54302.
Steps to reproduce:
- Open WebPositive
- Call command
hey application/x-vnd.Haiku-WebPositive get InternalName of Window 2
. Command will freeze. - Open script console (Window -> Script console).
- Call command from step 2 again. Now command will work properly.
Reason is that window is included in BApplication "Window" scripting property, but it have not started message loop so message can't be processed.
Change History (3)
comment:2 by , 4 years ago
I do this in some apps:
BWindow * win = new ...... win->Hide(); win->Show();
That gets the message loop going, _without_ showing the window on screen (since the call to Show() gets the show count from -1 to 0, instead of from 0 to 1).
Doing that solves a bunch of different issues, only one of which overlaps with this ticket (scripting). So I guess my point is, you've touched a somewhat sticky point of the BeOS/Haiku API here : scripting is only one of the things that is impacted by the BWindow API semantics. Going into R2, it might be worth including this discussion in the overall API overhaul discussions. So what to do... Pulkomandy could just use the above trick on the Web+ Console window and close this ticket, or we could do the scripting-specific work-arounds suggested above (in fact they seem to make sense regardless of what is done with the rest of the API), or we postpone this to R2 if not happy with work-arounds and in a quest to the ultimate fix 8-)
comment:3 by , 2 years ago
Here is a related ticket: #15364
hey
should probably have a reasonable timeout in general (mentioned in the above ticket), but I think it makes sense to not include windows in scripting if they don't have a looper running.
Possible solutions;