@@ -862,6 +862,8 @@ static int regiondata_set_parent(Py_region_t region, Py_region_t new_parent) {
862862 return 1 ;
863863 }
864864
865+ // TODO(regions): xFrednet: This is probably wrong? At least cleaning
866+ // (a region and sub region) seems to have a off-by-one counting a OSC of 2
865867 if (regiondata_dec_osc (old_parent )) {
866868 // Undo the inc_osc from above.
867869 regiondata_dec_osc (new_parent );
@@ -1462,7 +1464,6 @@ int regiondata_clean(PyObject* bridge) {
14621464 Py_region_t item_region = _PyRegion_Get (item );
14631465
14641466 assert (regiondata_is_bridge (item_region , item ));
1465- // TODO: Account in LRC for reference from owner, if present.
14661467
14671468 // Store metadata for the new region
14681469 assert (HAS_DATA (item_region ));
@@ -1491,17 +1492,16 @@ int regiondata_clean(PyObject* bridge) {
14911492 }
14921493 staged_ref_commit (staged_ref );
14931494
1495+ // TODO: Account in LRC for reference from owner, if present.
1496+
1497+
14941498 // TODO(regions): xFrednet: This doesn't account for region union...
14951499 //
1496- // `stage_objects` accounts for a reference from a contained object to
1497- // the added object, mening that the LRC is missing a count of 1 here.
1498- // We increment the LRC if it doesn't have a owner.
1499- if (owner == 0 ) {
1500- SUCCEEDS (regiondata_inc_lrc (clean_region ));
1501- // FIXME(regions): xFrednet: The hack currently marks the region as
1502- // dirty when the LRC is increased. the following function should
1503- // no longer be used when all barriers are in place
1504- SUCCEEDS (regiondata_mark_as_clean (clean_region ));
1500+ // `stage_objects` doesn't know about the reference from the owner and
1501+ // counts it as a local reference. Meaning the LRC counts one more
1502+ // reference than present.
1503+ if (owner != 0 ) {
1504+ SUCCEEDS (regiondata_dec_lrc (clean_region ));
15051505 }
15061506
15071507 // The region should now be marked as clean
0 commit comments