Project

General

Profile

Actions

Bug #5830

closed

Wt 4 : Disconnection from DOM ?

Added by Hyeoni Hwasoo over 6 years ago. Updated over 6 years ago.

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

0%

Estimated time:

Description

Hi, I'm migrating an application from Wt 3.3.6 to 4.0.0 rc1 and I encountered a very very strange behaviour.

This simple code in the middle of my application (in Wt 4) :

Wt::WLineEdit * edit = new Wt::WLineEdit();
edit->blurred().connect([edit]()
{
  std::cout << "Value = " << edit->text()->toUTF8() << std::endl;
});

displays always the same value when I enter manualy (through the web interface) and I quit the focus.

But when I test that code within a simple test application it works.

If the value is set by setText the correct value is displayed.

This behaviour is the same with Checkbox and Combobox (I did not test other component but I think I will be identical).

It appears as if there is a disconnection from the DOM.

How that could be ?

Actions #1

Updated by Roel Standaert over 6 years ago

  • Status changed from New to Feedback

That code fragment indeed seems to work when isolated (except that ->toUTF8() is supposed to be .toUTF8()).

So your WLineEdit is still visible, but you don't receive the blurred() signal anymore?

I don't know what OS you're using, but if you're on Linux or Mac, can you run your application with Valgrind and see if you're not running into any memory issues like user-after-free?

Actions #2

Updated by Hyeoni Hwasoo over 6 years ago

Sorry for the double posting http://redmine.webtoolkit.eu/boards/2/topics/13748 (I wrote some notes here).

The strange behaviour is : where I type something and when I quit the focus, yes the blurred event is triggered and I enter into the lambda function but the value I entered manually is not detected.

The same thing occured with other kind of component like WComboBox : the 'change' or 'activated' signal is well triggered but when I access to the cbx~~currentIndex() or cbx~~>currentText() it is not the new value I selected.

I'm unable to isolate the piece of code which is responsable. I'm currently suspecting the manner I'm using WStakedWidget and setCurrentIndex. (Yes the code worked fine in Wt 3.3.6 and after the migration with std::unique_ptr and the rest I encountered this behaviour). Because It seems it depends of the order I initialize the WStakedWidget and when I use setCurrentIndex. If the "initialisation" is "incorrect" (the strange behaviour occured) and after that if I change the current index, the strange behaviour disappears !!

Yes I'm looking for a bad use or a bad deletion of a pointer ... (which was maybe a latent bug)

My OS is Debian Jessie 64 bit.

Actions #3

Updated by Hyeoni Hwasoo over 6 years ago

The problem seems to be solved with the commit https://github.com/emweb/wt/commit/1e4ed289eb74e30374e9e8486b7def4b3c83fc89

Please close this issue.

Actions #4

Updated by Roel Standaert over 6 years ago

  • Status changed from Feedback to Resolved

That comes in handy. I would guess it's the change to signal/slot handling. Marking this as resolved until release, when it will be closed.

Actions #5

Updated by Roel Standaert over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF