FS#6589 - Crash: running the "rescannewgrf" command while newgrfs are already being scanned

Attached to Project: OpenTTD
Opened by James (james1101) - Monday, 17 July 2017, 08:20 GMT
Last edited by andythenorth (andythenorth) - Tuesday, 22 August 2017, 06:08 GMT
Type Bug
Category NewGRF
Status New
Assigned To No-one
Operating System Windows
Severity Low
Priority High
Reported Version Version?
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Using Windows 7 Ultimate

When running the rescannewgrf command twice in quick succession, a game crash occurs.

To Reproduce: (Works best when the game has a lot of GRFs to scan.)
Run the rescannewgrf command twice in quick succession.

Suggested Fix: When attempting to run the rescannewgrf command while the newgrfs are already being scanned, it should, instead of restarting the scan and crashing, output "Error: Newgrfs still being scanned, please wait til it's finished.", "ERR_NEWGRF_ALREADY_BEING_SCANNED", "ERR_NEWGRF_SCAN_IN_PROGRESS" or something like that.
   crash.png (376.3 KiB)
   crash.log (14.9 KiB)
(application/octet-stream)    crash.dmp (12.84 MiB)
This task depends upon

Comment by Grzegorz Duczyński (adf88) - Monday, 31 July 2017, 16:28 GMT
"Run the rescannewgrf command twice in quick succession" - how are you doing this? Seems impossible from the in-game console thus I see no need for a full-blown, language-aware GUI error. It's rather a case of blocking/queuing/dropping calls to rescannewgrf properly. The in-game console (~) is already blocked when scan is in progress. It should be anyway - is it different at your side?
Comment by James (james1101) - Monday, 31 July 2017, 17:52 GMT
I meant: Type 'rescannewgrf', then press the following in quick succession: Enter, Up arrow, Enter, Up arrow, Enter, ...
Comment by Grzegorz Duczyński (adf88) - Monday, 31 July 2017, 17:57 GMT
What version of OpenTTD are you using? Where did you get it?
Comment by James (james1101) - Tuesday, 01 August 2017, 00:42 GMT
I meant to say OpenTTD 1.7.1, downloaded from the Openttd website.
Comment by Grzegorz Duczyński (adf88) - Wednesday, 02 August 2017, 18:47 GMT
OK I see where's the problem now. At lest one of them. When newgrfrescan is in progress, hidden windows receive and process keyboard input (they shouldn't). So it is actually possible to run the command twice, even though you don't see it. It's a separate issue how commands are processed inside scripts tho.