Changeset 48c51ebb1336aac7ebb026a128457828782a87d6
- Timestamp:
- 31/05/08 22:56:19
(4 months ago)
- Author:
- Rémi Denis-Courmont <rdenis@simphalempin.com>
- git-committer:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1212267379 +0300
- git-parent:
[070e3454880e849f3ebca21d5f803cdd13351049]
- git-author:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1212267379 +0300
- Message:
The not-so-dumb references checker
I saw you, evil preparser thread...
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r070e345 |
r48c51eb |
|
| 1556 | 1556 | return; |
|---|
| 1557 | 1557 | |
|---|
| 1558 | | /* A thread can use its own object without reference! */ |
|---|
| | 1558 | /* A thread can use its own object without references! */ |
|---|
| 1559 | 1559 | vlc_object_t *caller = vlc_threadobj (); |
|---|
| 1560 | 1560 | if (caller == obj) |
|---|
| 1561 | 1561 | return; |
|---|
| 1562 | | |
|---|
| | 1562 | #if 0 |
|---|
| 1563 | 1563 | /* The calling thread is younger than the object. |
|---|
| 1564 | 1564 | * Access could be valid through cross-thread synchronization; |
|---|
| … | … | |
| 1566 | 1566 | if (caller && (caller->i_object_id > obj->i_object_id)) |
|---|
| 1567 | 1567 | return; |
|---|
| 1568 | | |
|---|
| | 1568 | #endif |
|---|
| 1569 | 1569 | int refs; |
|---|
| 1570 | 1570 | vlc_spin_lock (&priv->ref_spin); |
|---|
| … | … | |
| 1572 | 1572 | vlc_spin_unlock (&priv->ref_spin); |
|---|
| 1573 | 1573 | |
|---|
| 1574 | | /* Object has more than one reference. |
|---|
| 1575 | | * The current thread could be holding a valid reference. */ |
|---|
| 1576 | | if (refs > 1) |
|---|
| 1577 | | return; |
|---|
| | 1574 | for (held_list_t *hlcur = vlc_threadvar_get (&held_objects); |
|---|
| | 1575 | hlcur != NULL; hlcur = hlcur->next) |
|---|
| | 1576 | if (hlcur->obj == obj) |
|---|
| | 1577 | return; |
|---|
| 1578 | 1578 | |
|---|
| 1579 | 1579 | fprintf (stderr, "The %s %s thread object is accessing...\n" |
|---|
| 1580 | | "the %s %s object in a suspicous manner.\n", |
|---|
| | 1580 | "the %s %s object without references.\n", |
|---|
| 1581 | 1581 | caller && caller->psz_object_name |
|---|
| 1582 | 1582 | ? caller->psz_object_name : "unnamed", |
|---|