mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 22:48:49 +00:00
validate-report: Make the ref / unref functions safer.
This commit is contained in:
parent
1fcaf8918f
commit
b8ac717297
1 changed files with 4 additions and 0 deletions
|
@ -432,6 +432,8 @@ gst_validate_report_new (GstValidateIssue * issue,
|
||||||
void
|
void
|
||||||
gst_validate_report_unref (GstValidateReport * report)
|
gst_validate_report_unref (GstValidateReport * report)
|
||||||
{
|
{
|
||||||
|
g_return_if_fail (report != NULL);
|
||||||
|
|
||||||
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
|
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
|
||||||
g_free (report->message);
|
g_free (report->message);
|
||||||
g_slice_free (GstValidateReport, report);
|
g_slice_free (GstValidateReport, report);
|
||||||
|
@ -441,6 +443,8 @@ gst_validate_report_unref (GstValidateReport * report)
|
||||||
GstValidateReport *
|
GstValidateReport *
|
||||||
gst_validate_report_ref (GstValidateReport * report)
|
gst_validate_report_ref (GstValidateReport * report)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (report != NULL, NULL);
|
||||||
|
|
||||||
g_atomic_int_inc (&report->refcount);
|
g_atomic_int_inc (&report->refcount);
|
||||||
|
|
||||||
return report;
|
return report;
|
||||||
|
|
Loading…
Reference in a new issue