HeinrichApfelmus / threepenny-gui

GUI framework that uses the web browser as a display.
https://heinrichapfelmus.github.io/threepenny-gui/
Other
439 stars 77 forks source link

Regression: Update doesn't work in CRUD sample . #109

Closed massudaw closed 9 years ago

massudaw commented 9 years ago

When i select one element in the list the form doesn't get updated. This behavior was observed using version 0.6.0.1 with ghc 7.8.4 . Using the version 0.4.2.0 works fine.

OBS.: When i tried to upgrade other application to this version i had some problems with missing events too.

Can you reproduce, this?

HeinrichApfelmus commented 9 years ago

I can reproduce this. Apparently, a function created with exportHandler is being garbage collected (A click handler for the select box is registered, but the corresponding function is freed with Haskell.freeStablePtr('50')). I will try to investigate the cause.

HeinrichApfelmus commented 9 years ago

The problem is a line in the clearChildren function where all remote pointers reachable from the element are cleared. The idea was to sever the connection to the child DOM elements, so that they can be garbage collected if necessary. However, I forgot that the reachable remote pointers are not restricted to DOM elements, but can also be event handlers, which should not be cleared, of course. I will have to mirror the DOM hierarchy more precisely.

For a temporary fix, just delete the indicated line.

duplode commented 9 years ago

Seen in the wild in this StackOverflow question. By the way, if I start playing with 0.6 before the bug fix comes should I look out for any collateral effects of the workaround in code originally written for 0.5?

HeinrichApfelmus commented 9 years ago

The only collateral effect is that less elements will be garbage collected. In most cases, especially when you only ever create a fixed number of DOM elements, you won't notice a difference.