Worked around a assertion failure in the lobby.
The bug seems rather rare and only boucman has reported it, since I haven't been able to reproduce it I'm not conviced this fix really works. But since the current code causes an assertion failure, there's no risk of regressions. Boucman when possible please test and look whether you get the error message in listbox.cpp on your console output, this would be the point where you normally ran into the assertion failure.
This commit is contained in:
parent
f2b8b94d0b
commit
8e38e28bb2
4 changed files with 23 additions and 1 deletions
|
@ -37,6 +37,7 @@ Version 1.7.15+svn:
|
|||
* Worked around bug #13333: Limit the maximum length of the mp command
|
||||
dialog as workaround for bug (This workaround is only implemented for
|
||||
Windows and Mac)
|
||||
* Worked around a rare assertion failure when resizing the lobby
|
||||
|
||||
Version 1.7.15-1.8rc1:
|
||||
* AI:
|
||||
|
|
|
@ -47,6 +47,16 @@ struct tlayout_exception_height_resize_failed
|
|||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* Exception thrown when the placement failed.
|
||||
*
|
||||
* @todo This exception is used as surrogate fix the lobby crash.
|
||||
* Remove the commit that introduced us.
|
||||
*/
|
||||
struct tlayout_placement_failed
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
|
@ -535,6 +535,7 @@ void tgrid::place(const tpoint& origin, const tpoint& size)
|
|||
}
|
||||
|
||||
// This shouldn't be possible...
|
||||
throw tlayout_placement_failed();
|
||||
assert(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
|
||||
#include "gui/auxiliary/layout_exception.hpp"
|
||||
#include "gui/auxiliary/log.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
||||
|
@ -481,7 +482,16 @@ void tlistbox::set_content_size(const tpoint& origin, const tpoint& size)
|
|||
|
||||
const int best_height = content_grid()->get_best_size().y;
|
||||
const tpoint s(size.x, size.y < best_height ? size.y : best_height);
|
||||
content_grid()->place(origin, s);
|
||||
try {
|
||||
content_grid()->place(origin, s);
|
||||
} catch(tlayout_placement_failed&) {
|
||||
ERR_GUI_L << LOG_HEADER << " placement of the content has failed, "
|
||||
" hope the window can save us.\n";
|
||||
twindow *window = get_window();
|
||||
assert(window);
|
||||
|
||||
window->invalidate_layout();
|
||||
}
|
||||
}
|
||||
|
||||
void tlistbox::layout_children(const bool force)
|
||||
|
|
Loading…
Add table
Reference in a new issue