Skip to content
Snippets Groups Projects
user avatar
Vincent Schippefilt authored
During the unit tests, I have noticed that the test window was doing a
lot of work after the test were completed, it was using CPU and using RAM
in jigsaw pattern. Eventually after being left alone for a few hours,
the window would just crash.

This was due to an unlimitted chain of deferred running when an image
field had a load error.

The situation is as such:
1. The image is put in the DOM with an onError handler
2. There is an error, as the image is a dummy text for the tests
3. The onError is called, it clears the image field, then calls _render
4. _render re-adds an image with the same onError handler   <----------
5. The onError is called - again - it clears the image field - again  |
   (wich does nothing this time because the value is the same) -      |
   then calls _render - again                                         |
6. The second time _render is called, go to step 4 --------------------

... In the meantime, the widget has been destroyed by the test,
so it should not do anything anymore.

This fix breaks the loop, as well as bind the onError handled with 'one'
instead of 'on'.

closes odoo/odoo#30716
2e57f90b
History
Name Last commit Last update