Bug #568
following NULL pointer in WLayout::setParentLayout
0%
Description
Hi,
I'm in a debugger right now looking at a stack trace from trying to add a WHBoxLayout to a WGridLayout. Specifically it's being added at (1,0) of a grid with spans (1,2).
In WLayout::updateRemoveItem there is a call to item~~setParentLayout(0) at line 128. In that method, the parameter is called layout and there is a call to layout~~>addChild(this) at line 185, without a NULL check.
Unless I'm missing something, wouldn't it always be bad to pass a NULL to setParentLayout?
Thanks,
Sean
s. At one point last week I had a very strange crash that included an "impossible" stack trace - one where the stack abruptly jumped to a different virtual method than was possible according to the inheritance hierarchy. Compiling Wt without -O2 resolved that and since then I've only used the non-release library, so I don't think it's the issue this time.
Updated by Sean Hogan over 12 years ago
Sorry I filed that without signing in first... it was me.
Sean Hogan
Updated by Sean Hogan over 12 years ago
One more thing... I just realized I had the row number wrong: I should have been adding at (2,0), but used (1,0) instead. That location already had an item assigned (a layout) so it went into the WGridLayout::addItem logic to replace an existing item.
Updated by Koen Deforche over 12 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
Hey Sean,
This is something that was already fixed in latest git (and we are close to a release !):
void WLayout::setParentLayout(WLayout *layout) { if (layout) layout->addChild(this); else setParent(0); }
Regards,
koen