a7363381cbeff87cae9b79519344362559a5797a
Steps to reproduce the bug: - Add an Image Gallery (IG) snippet on the page. - Click on "Remove all" to remove all the images of the IG snippet. - Add 2 new images in the IG. - Click on the first image of the IG to load its data. - Click on the trash button to remove the snippet. - Bug => The snippet is not removed (an image is removed instead). When a snippet is removed, the `removeSnippet` function is called. The problem is that the `call_for_each_child_snippet` will never resolve. Two mechanisms are of interest to understand why: the first one is the `updateCurrentSnippetEditorOverlay` function. Its goal is to destroy a snippet each time its target is not in the DOM anymore. The second mechanism is specific to the IG snippet: when an image of this snippet is destroyed, the `slideshow` function goes through the remaining images to update parameters. To do it, the function uses the `_replaceContent` function that empties the content of the carousel and then fills it with new data. When a snippet is removed, a `SnippetEditor` is created for each element of it. In the case of the IG, a `SnippetEditor` is created for each image of the the snippet. Because the first image already has a `SnippetEditor` (because it has been clicked), the callback of `call_for_each_child_snippet` is called to remove this image from the IG snippet. The second mechanism explained before will then be called. Meanwhile, a `SnippetEditor` will be created for the second image. However, because the `_replaceContent` function emptied the content of the carousel, the `updateCurrentSnippetEditorOverlay` function will destroy the `SnippetEditor` of the second image as its target is not considered present in the DOM anymore. Unfortunately, the `call_for_each_child_snippet` still needed this `SnippetEditor` and will never entirely resolve. To solve this problem, the `removeSnippet` function is executed inside a mutex. Because the mutex is also used by `updateCurrentSnippetEditorOverlay`, we are sure that this function will not destroy the snippetEditor while the `removeSnippet` is still running. task-3147271 closes odoo/odoo#116352 X-original-commit: 1c99ab2bc04f65999098f70d062d24ed1ac4a9c3 Signed-off-by: Arthur Detroux (ard) <ard@odoo.com> Signed-off-by: loco-odoo <loco@odoo.com>
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%