(svn r17291) -Fix [FS#3147]: crash after upgrading base graphics/sound set when opening the game options menu and you were using the upgraded set
This commit is contained in:
		@@ -159,6 +159,11 @@ bool BaseMedia<Tbase_set>::AddFile(const char *filename, size_t basepath_length)
 | 
				
			|||||||
				/* don't allow recursive delete of all remaining items */
 | 
									/* don't allow recursive delete of all remaining items */
 | 
				
			||||||
				duplicate->next = NULL;
 | 
									duplicate->next = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									/* If the duplicate set is currently used (due to rescanning this can happen)
 | 
				
			||||||
 | 
									 * update the currently used set to the new one. This will 'lie' about the
 | 
				
			||||||
 | 
									 * version number until a new game is started which isn't a big problem */
 | 
				
			||||||
 | 
									if (BaseMedia<Tbase_set>::used_set == duplicate) BaseMedia<Tbase_set>::used_set = set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				DEBUG(grf, 1, "Removing %s (%i) as base " SET_TYPE " set (duplicate)", duplicate->name, duplicate->version);
 | 
									DEBUG(grf, 1, "Removing %s (%i) as base " SET_TYPE " set (duplicate)", duplicate->name, duplicate->version);
 | 
				
			||||||
				delete duplicate;
 | 
									delete duplicate;
 | 
				
			||||||
				ret = true;
 | 
									ret = true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,10 +100,12 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				case CONTENT_TYPE_BASE_GRAPHICS:
 | 
									case CONTENT_TYPE_BASE_GRAPHICS:
 | 
				
			||||||
					BaseGraphics::FindSets();
 | 
										BaseGraphics::FindSets();
 | 
				
			||||||
 | 
										InvalidateWindow(WC_GAME_OPTIONS, 0);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				case CONTENT_TYPE_BASE_SOUNDS:
 | 
									case CONTENT_TYPE_BASE_SOUNDS:
 | 
				
			||||||
					BaseSounds::FindSets();
 | 
										BaseSounds::FindSets();
 | 
				
			||||||
 | 
										InvalidateWindow(WC_GAME_OPTIONS, 0);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				case CONTENT_TYPE_NEWGRF:
 | 
									case CONTENT_TYPE_NEWGRF:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user