Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
48c51ebb
Commit
48c51ebb
authored
May 31, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The not-so-dumb references checker
I saw you, evil preparser thread...
parent
070e3454
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
src/misc/objects.c
src/misc/objects.c
+8
-8
No files found.
src/misc/objects.c
View file @
48c51ebb
...
@@ -1555,29 +1555,29 @@ void vlc_refcheck (vlc_object_t *obj)
...
@@ -1555,29 +1555,29 @@ void vlc_refcheck (vlc_object_t *obj)
#endif
#endif
return
;
return
;
/* A thread can use its own object without reference! */
/* A thread can use its own object without reference
s
! */
vlc_object_t
*
caller
=
vlc_threadobj
();
vlc_object_t
*
caller
=
vlc_threadobj
();
if
(
caller
==
obj
)
if
(
caller
==
obj
)
return
;
return
;
#if 0
/* The calling thread is younger than the object.
/* The calling thread is younger than the object.
* Access could be valid through cross-thread synchronization;
* Access could be valid through cross-thread synchronization;
* we would need better accounting. */
* we would need better accounting. */
if (caller && (caller->i_object_id > obj->i_object_id))
if (caller && (caller->i_object_id > obj->i_object_id))
return;
return;
#endif
int
refs
;
int
refs
;
vlc_spin_lock
(
&
priv
->
ref_spin
);
vlc_spin_lock
(
&
priv
->
ref_spin
);
refs
=
priv
->
i_refcount
;
refs
=
priv
->
i_refcount
;
vlc_spin_unlock
(
&
priv
->
ref_spin
);
vlc_spin_unlock
(
&
priv
->
ref_spin
);
/* Object has more than one reference.
for
(
held_list_t
*
hlcur
=
vlc_threadvar_get
(
&
held_objects
);
* The current thread could be holding a valid reference. */
hlcur
!=
NULL
;
hlcur
=
hlcur
->
next
)
if
(
refs
>
1
)
if
(
hlcur
->
obj
==
obj
)
return
;
return
;
fprintf
(
stderr
,
"The %s %s thread object is accessing...
\n
"
fprintf
(
stderr
,
"The %s %s thread object is accessing...
\n
"
"the %s %s object
in a suspicous manner
.
\n
"
,
"the %s %s object
without references
.
\n
"
,
caller
&&
caller
->
psz_object_name
caller
&&
caller
->
psz_object_name
?
caller
->
psz_object_name
:
"unnamed"
,
?
caller
->
psz_object_name
:
"unnamed"
,
caller
?
caller
->
psz_object_type
:
"main"
,
caller
?
caller
->
psz_object_type
:
"main"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment