Project

General

Profile

Actions

Bug #7128

closed

Setting a new layout on top of root

Added by Sebastian Fett almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/02/2019
Due date:
% Done:

0%

Estimated time:
1:00 h

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

issue_7128.patch (4.04 KB) issue_7128.patch Roel Standaert, 07/02/2019 06:10 PM
Actions #1

Updated by Roel Standaert almost 5 years ago

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.

Actions #2

Updated by Roel Standaert almost 5 years ago

  • Status changed from New to Resolved

Just pushed a fix. This should be resolved now.

Actions #3

Updated by Roel Standaert over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF