Revert 2010-05-03T19:30:10Z!koraq@xs4all.nl.

Forgot that a vector copies on resize, which causes problems.
This commit is contained in:
Mark de Wever 2010-05-05 14:04:25 +00:00
parent 6114298670
commit 8a4c7f4ea9
2 changed files with 11 additions and 7 deletions

View file

@ -42,6 +42,15 @@ tgrid::tgrid(const unsigned rows, const unsigned cols)
{
}
tgrid::~tgrid()
{
// Delete the children in this destructor since resizing a vector copies the
// children and thus frees the child prematurely.
foreach(tchild& child, children_) {
delete child.widget();
}
}
unsigned tgrid::add_row(const unsigned count)
{
assert(count);
@ -677,11 +686,6 @@ void tgrid::set_rows_cols(const unsigned rows, const unsigned cols)
children_.resize(rows_ * cols_);
}
tgrid::tchild::~tchild()
{
delete widget_;
}
tpoint tgrid::tchild::get_best_size() const
{
log_scope2(log_gui_layout, LOG_CHILD_SCOPE_HEADER)

View file

@ -37,6 +37,8 @@ public:
tgrid(const unsigned rows = 0, const unsigned cols = 0);
virtual ~tgrid();
/***** ***** ***** ***** LAYOUT FLAGS ***** ***** ***** *****/
static const unsigned VERTICAL_SHIFT = 0;
static const unsigned VERTICAL_GROW_SEND_TO_CLIENT = 1 << VERTICAL_SHIFT;
@ -300,8 +302,6 @@ private:
// regarding size etc.
{}
~tchild();
/** Returns the best size for the cell. */
tpoint get_best_size() const;