Window title delay opening Workbench console output window

This forum is for general developer support questions.

Window title delay opening Workbench console output window

Postby whose » Fri Jan 27, 2017 12:30 pm

Hello!

Recently I discovered a small glitch with e.g. Workbench console output window. While Workbench opens this window, the window title is empty (NULL pointer). There is a slight delay and then the window title is set. There is no difference with windows opened by Workbench directly or by the program itself if this program uses Open() to make up the console window. So, most likely this glitch is located within console-handler?

This glitch breaks some programs which try to change the window title, due to a race condition. For example, the (rather old) Telnet client found at os4depot.net.

I know, it isn´t very clever to do those changes as this "crosses the border" between individual process´ resources, which shouldn´t be done at all (I don´t do this in my own programs).

I would use either a pointer check prior to the window title change, but this would break the title change functionality in whole, or I could use a Delay() to prevent the race condition happening, but this would introduce an user-annoying pause and an additional possibility for a different race condition.

But as there are such programs, still in use, I would like to ask, if there is a recommended way to change the window title of a newly opened console output window in a safe way.
whose
 
Posts: 92
Joined: Sun Sep 04, 2011 4:11 pm

Re: Window title delay opening Workbench console output wind

Postby tonyw » Fri Jan 27, 2017 1:12 pm

The window title is polled regularly to look for changes due to volatile fields and is updated only on those occasions.

The default window title is taken from the console prefs but may be redefined by a call to SetAttrs (CDT_SETWINDOWTITLE, CONST_STRPTR title). I suppose to be sure that the title is non-null, I could set it before the window opens, but that would then open the possibility of other programs writing over the title at any old time and even of memory leaks by over-writing pointers to the title string.

I think the best way is to ignore dinosaur programs that want to over-write the existing string and just expect them to use the given API.

See SDK:Documentation/Autodocs/console.doc (CD_SETATTRS) for details.
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1248
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: Window title delay opening Workbench console output wind

Postby whose » Fri Jan 27, 2017 2:51 pm

Aaaaah... I´m getting old, I think. I totally overlooked the CDT_SETWINDOWTITLE, CONST_STRPTR title part of the console autodoc :shock:

From time to time I really enjoy playing some kind of Jurassic Park within AmigaOS :mrgreen:

The telnet client uses the packet interface of console.device already, so it should be no big deal to overhaul the code that is changing the window title to reflect the host it is connected to (and some other small but important things).

Thank you very much!
whose
 
Posts: 92
Joined: Sun Sep 04, 2011 4:11 pm

Re: Window title delay opening Workbench console output wind

Postby tonyw » Sat Jan 28, 2017 12:07 am

NP
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1248
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron