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:

  1. Open WebPositive
  2. Call command hey application/x-vnd.Haiku-WebPositive get InternalName of Window 2. Command will freeze.
  3. Open script console (Window -> Script console).
  4. 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:1 by X512, 4 years ago

Possible solutions:

  1. Window should not be included to "Window" property before message loop will be started.
  2. Error reply message should be sent if attempted to send message to not yet started looper.
Last edited 4 years ago by X512 (previous) (diff)

comment:2 by ttcoder, 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-)

Last edited 4 years ago by ttcoder (previous) (diff)

comment:3 by leavengood, 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.

Note: See TracTickets for help on using tickets.