Skip to content

Commit 61dae3d

Browse files
committed
Fix infinite loop when iterating over group objects while adding new objects (closes #274)
ObjectGroup.get_object_ids() was returning a direct reference to its internal list instead of a copy. When plugins iterated over this list while adding new objects to the panel, the internal list grew during iteration, causing an infinite loop. The fix ensures get_object_ids() returns a copy of the list, making iteration safe even when modifying the group during the loop. Fixes #274
1 parent 5b2dfb3 commit 61dae3d

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

datalab/objectmodel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def get_objects(self) -> list[SignalObj | ImageObj]:
189189

190190
def get_object_ids(self) -> list[str]:
191191
"""Return object ids in group"""
192-
return self.__objects
192+
return self.__objects.copy()
193193

194194

195195
class ObjectModel:

doc/locale/fr/LC_MESSAGES/release_notes/release_1.00.po

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: DataLab \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2025-12-04 17:48+0100\n"
10+
"POT-Creation-Date: 2025-12-12 19:37+0100\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language: fr\n"
@@ -27,6 +27,33 @@ msgstr ""
2727
msgid "🛠️ Bug Fixes since version 1.0.2"
2828
msgstr "🛠️ Correctifs depuis la version 1.0.2"
2929

30+
msgid "**Plugin development - Infinite loop when iterating over group objects:**"
31+
msgstr "**Développement de plugins - Boucle infinie lors de l'itération sur les objets d'un groupe :**"
32+
33+
msgid "Fixed infinite loop occurring in plugins when iterating over object IDs returned by `ObjectGroup.get_object_ids()` while simultaneously adding new objects to the same group"
34+
msgstr "Correction de la boucle infinie se produisant dans les plugins lors de l'itération sur les identifiants d'objets retournés par `ObjectGroup.get_object_ids()` tout en ajoutant simultanément de nouveaux objets au même groupe"
35+
36+
msgid "The method was returning a direct reference to the internal list instead of a copy, causing the iteration to include newly added objects and loop indefinitely"
37+
msgstr "La méthode retournait une référence directe à la liste interne au lieu d'une copie, ce qui faisait que l'itération incluait les objets nouvellement ajoutés et bouclait indéfiniment"
38+
39+
msgid "This particularly affected plugin workflows that loop over signals/images in a group and add results to the same or another group"
40+
msgstr "Cela affectait particulièrement les flux de travail des plugins qui bouclent sur les signaux/images d'un groupe et ajoutent des résultats au même groupe ou à un autre groupe"
41+
42+
msgid "The fix ensures `get_object_ids()` now returns a copy of the list, making iteration safe even when modifying the group"
43+
msgstr "Le correctif garantit que `get_object_ids()` retourne désormais une copie de la liste, rendant l'itération sûre même lors de la modification du groupe"
44+
45+
msgid "This closes [Issue #274](https://github.com/datalab-platform/datalab/issues/274) - Infinite loop when iterating over group objects while adding new objects"
46+
msgstr "Ceci clôture [Issue #274](https://github.com/datalab-platform/datalab/issues/274) - Boucle infinie lors de l'itération sur les objets d'un groupe tout en ajoutant de nouveaux objets"
47+
48+
msgid "**Marker visibility:**"
49+
msgstr "**Visibilité des marqueurs :**"
50+
51+
msgid "Fixed cross marker (shown when pressing Alt key on plot) colors inherited from PlotPy being too pale on white background, and other marker properties explicitly configured for better contrast"
52+
msgstr "Correction des couleurs du marqueur en croix (affiché en appuyant sur la touche Alt sur le graphique) héritées de PlotPy étant trop pâles sur fond blanc, et d'autres propriétés de marqueurs explicitement configurées pour un meilleur contraste"
53+
54+
msgid "Fixed default annotation colors inherited from PlotPy being too pale on white background - segment and drag shape annotations now use brighter green (`#00ff55`) for better visibility"
55+
msgstr "Correction des couleurs d'annotation par défaut héritées de PlotPy étant trop pâles sur fond blanc - les annotations de segments et de formes glissées utilisent désormais un vert plus vif (`#00ff55`) pour une meilleure visibilité"
56+
3057
msgid "**Macro panel layout:**"
3158
msgstr "**Disposition du panneau des macros :**"
3259

doc/release_notes/release_1.00.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
### 🛠️ Bug Fixes since version 1.0.2 ###
66

7+
**Plugin development - Infinite loop when iterating over group objects:**
8+
9+
* Fixed infinite loop occurring in plugins when iterating over object IDs returned by `ObjectGroup.get_object_ids()` while simultaneously adding new objects to the same group
10+
* The method was returning a direct reference to the internal list instead of a copy, causing the iteration to include newly added objects and loop indefinitely
11+
* This particularly affected plugin workflows that loop over signals/images in a group and add results to the same or another group
12+
* The fix ensures `get_object_ids()` now returns a copy of the list, making iteration safe even when modifying the group
13+
* This closes [Issue #274](https://github.com/datalab-platform/datalab/issues/274) - Infinite loop when iterating over group objects while adding new objects
14+
715
**Marker visibility:**
816

917
* Fixed cross marker (shown when pressing Alt key on plot) colors inherited from PlotPy being too pale on white background, and other marker properties explicitly configured for better contrast

0 commit comments

Comments
 (0)