Bug #7128
closedSetting a new layout on top of root
0%
Description
How would I generally do that.
My WT3 code allowed me to slap a new layout on top of root no matter the current widgets in root and basically fill the page with new content (say as an update to visuals). If I do the same in Wt4 I get "undefined WT error a is a null". If I run root()->clear() the code segfaults as the auth widget gets deleted as well but is apparently necessary for your DB/session interaction.
Ive been trying for a few weeks now to get a reply in your forums: https://redmine.webtoolkit.eu/boards/2/topics/16142?r=16169#message-16169
but nothing helped.
Files
Updated by Roel Standaert almost 5 years ago
- File issue_7128.patch issue_7128.patch added
- Tracker changed from Support to Bug
I think it makes sense that setLayout
should actually clear what's already there (i.e. clear the container instead of just any existing layout). I think that's the cause of that JavaScript issue.
As a workaround, you can (for now) clear the container before you set a layout.
As for the error you get when you clear it, that is indeed related to the fact that at that some part of the AuthWidget (the AuthModel) is still being used after the AuthWidget was deleted. Maybe we should always use a shared_ptr
for the AuthModel
. Then we case use shared_from_this
to keep it around for just long enough.
As far as workarounds go, you could remove the AuthWidget
from root()
into a unique_ptr
before you clear it (and then keep that unique_ptr
around for a bit longer). That's not very nice, though.
I attached the patch I was working on if you want to check it out, may commit this soon.
Updated by Roel Standaert almost 5 years ago
- Status changed from New to Resolved
Just pushed a fix. This should be resolved now.
Updated by Roel Standaert over 4 years ago
- Status changed from Resolved to Closed