Changeset 6be4142 in mainline for uspace/app/bithenge/sequence.c
- Timestamp:
- 2012-08-12T04:53:47Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b6b76d
- Parents:
- 0153c87
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/sequence.c
r0153c87 r6be4142 418 418 struct_node_t *node = node_as_struct(base); 419 419 420 /* We didn't inc_ref for the scope in struct_transform_make_node, so 421 * make sure it doesn't try to dec_ref. */ 422 seq_node_scope(struct_as_seq(node))->current_node = NULL; 423 seq_node_destroy(struct_as_seq(node)); 420 /* Treat the scope carefully because of the circular reference. In 421 * struct_transform_make_node, things are set up so node owns a 422 * reference to the scope, but scope doesn't own a reference to node, 423 * so node's reference count is too low. */ 424 bithenge_scope_t *scope = seq_node_scope(struct_as_seq(node)); 425 if (scope->refs == 1) { 426 /* Mostly normal destroy, but we didn't inc_ref(node) for the 427 * scope in struct_transform_make_node, so make sure it doesn't 428 * try to dec_ref. */ 429 scope->current_node = NULL; 430 seq_node_destroy(struct_as_seq(node)); 431 } else if (scope->refs > 1) { 432 /* The scope is still needed, but node isn't otherwise needed. 433 * Switch things around so scope owns a reference to node, but 434 * not vice versa, and scope's reference count is too low. */ 435 bithenge_node_inc_ref(base); 436 bithenge_scope_dec_ref(scope); 437 return; 438 } else { 439 /* This happens after the previous case, when scope is no 440 * longer used and is being destroyed. Since scope is already 441 * being destroyed, set it to NULL here so we don't try to 442 * destroy it twice. */ 443 struct_as_seq(node)->scope = NULL; 444 seq_node_destroy(struct_as_seq(node)); 445 } 424 446 425 447 bithenge_transform_dec_ref(struct_as_transform(node->transform));
Note:
See TracChangeset
for help on using the changeset viewer.