Changeset - r22028:c8bbbf74f8f2
[Not reviewed]
master
0 1 0
rubidium - 9 years ago 2015-03-13 20:54:35
rubidium@openttd.org
(svn r27185) -Fix: prevent the compiler from optimizing an assignment away which caused GCC 5 to actually crash
1 file changed with 10 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/window.cpp
Show inline comments
 
@@ -1079,7 +1079,16 @@ Window::~Window()
 
	free(this->nested_array); // Contents is released through deletion of #nested_root.
 
	delete this->nested_root;
 

	
 
	this->window_class = WC_INVALID;
 
	/*
 
	 * Make fairly sure that this is written, and not "optimized" away.
 
	 * The delete operator is overwritten to not delete it; the deletion
 
	 * happens at a later moment in time after the window has been
 
	 * removed from the list of windows to prevent issues with items
 
	 * being removed during the iteration as not one but more windows
 
	 * may be removed by a single call to ~Window by means of the
 
	 * DeleteChildWindows function.
 
	 */
 
	const_cast<volatile WindowClass &>(this->window_class) = WC_INVALID;
 
}
 

	
 
/**
0 comments (0 inline, 0 general)