Race during startup posts incorrect window width/height?

Posted by Fiendish on Mon 25 Feb 2013 07:10 PM — 8 posts, 24,577 views.

USA Global Moderator #0
In the moments during client start up, calls to GetInfo(280) and GetInfo(281) can apparently report the wrong numbers. I say wrong here because it looks like maybe the client window zooms to size but hasn't gotten to the desired size yet?

A user reported the following to me.

Quote:
when I start mush, the GetInfo(281) is returning a (incorrect?) value of 645.

If I reinstall the plugin, GetInfo(281) returns a more realistic value.

Debug Data on initial load
~~~~~~~~~~~~~~~~~~~~~~~~~~

GetInfo(281) = 645

Debug Data on plugin reinstall
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GetInfo(281) = 1303


I have noticed this myself in the past as well, but didn't think to report it as a problem for some reason.
Australia Forum Administrator #1
There are some race conditions there. Especially during initial startup the windows can be set to some default size (eg. chosen by the MFC library) before the code in MUSHclient has had a chance to read the saved window positions for that world and fix things up.
Australia Forum Administrator #2
In particular, plugins are installed, and OnPluginInstall called, before the output window is set up.

I would suggest a short delay after the plugin starts up, if you need to know the output window size, that would give it a chance to stabilize.
USA Global Moderator #3
Quote:
In particular, plugins are installed, and OnPluginInstall called, before the output window is set up.

Is this avoidable? It's not intuitive and will randomly screw up anyone who tries to get window geometry at plugin load.
Amended on Tue 26 Feb 2013 02:16 AM by Fiendish
Australia Forum Administrator #4
See this post perhaps:

Template:post=11226
Please see the forum thread: http://gammon.com.au/forum/?id=11226.



:P
Australia Forum Administrator #5
Fiendish said:

Is this avoidable?


I can't think of any particularly easy way, except maybe to defer loading plugins until somewhat later in the world-opening process.
Australia Forum Administrator #6
Plugin loading is done as part of world (input) serialization, which is a part of opening a document. Basically we have all the XML data in memory, and are working through the various types of data (triggers, aliases etc.)

I'm not quite sure of the ramifications of attempting to defer the plugin part.
USA Global Moderator #7
Nick Gammon said:

See this post perhaps:

(post=11226)

:P


See? Randomly even to people who knew about it 2 years ago.