1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2022 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #include "modules/portal/scoped_glib.h" 12*d9f75844SAndroid Build Coastguard Worker 13*d9f75844SAndroid Build Coastguard Worker namespace webrtc { 14*d9f75844SAndroid Build Coastguard Worker 15*d9f75844SAndroid Build Coastguard Worker template <> ~Scoped()16*d9f75844SAndroid Build Coastguard WorkerScoped<GError>::~Scoped() { 17*d9f75844SAndroid Build Coastguard Worker if (ptr_) { 18*d9f75844SAndroid Build Coastguard Worker g_error_free(ptr_); 19*d9f75844SAndroid Build Coastguard Worker } 20*d9f75844SAndroid Build Coastguard Worker } 21*d9f75844SAndroid Build Coastguard Worker 22*d9f75844SAndroid Build Coastguard Worker template <> ~Scoped()23*d9f75844SAndroid Build Coastguard WorkerScoped<char>::~Scoped() { 24*d9f75844SAndroid Build Coastguard Worker if (ptr_) { 25*d9f75844SAndroid Build Coastguard Worker g_free(ptr_); 26*d9f75844SAndroid Build Coastguard Worker } 27*d9f75844SAndroid Build Coastguard Worker } 28*d9f75844SAndroid Build Coastguard Worker 29*d9f75844SAndroid Build Coastguard Worker template <> ~Scoped()30*d9f75844SAndroid Build Coastguard WorkerScoped<GVariant>::~Scoped() { 31*d9f75844SAndroid Build Coastguard Worker if (ptr_) { 32*d9f75844SAndroid Build Coastguard Worker g_variant_unref(ptr_); 33*d9f75844SAndroid Build Coastguard Worker } 34*d9f75844SAndroid Build Coastguard Worker } 35*d9f75844SAndroid Build Coastguard Worker 36*d9f75844SAndroid Build Coastguard Worker template <> ~Scoped()37*d9f75844SAndroid Build Coastguard WorkerScoped<GVariantIter>::~Scoped() { 38*d9f75844SAndroid Build Coastguard Worker if (ptr_) { 39*d9f75844SAndroid Build Coastguard Worker g_variant_iter_free(ptr_); 40*d9f75844SAndroid Build Coastguard Worker } 41*d9f75844SAndroid Build Coastguard Worker } 42*d9f75844SAndroid Build Coastguard Worker 43*d9f75844SAndroid Build Coastguard Worker template <> ~Scoped()44*d9f75844SAndroid Build Coastguard WorkerScoped<GDBusMessage>::~Scoped() { 45*d9f75844SAndroid Build Coastguard Worker if (ptr_) { 46*d9f75844SAndroid Build Coastguard Worker g_object_unref(ptr_); 47*d9f75844SAndroid Build Coastguard Worker } 48*d9f75844SAndroid Build Coastguard Worker } 49*d9f75844SAndroid Build Coastguard Worker 50*d9f75844SAndroid Build Coastguard Worker template <> ~Scoped()51*d9f75844SAndroid Build Coastguard WorkerScoped<GUnixFDList>::~Scoped() { 52*d9f75844SAndroid Build Coastguard Worker if (ptr_) { 53*d9f75844SAndroid Build Coastguard Worker g_object_unref(ptr_); 54*d9f75844SAndroid Build Coastguard Worker } 55*d9f75844SAndroid Build Coastguard Worker } 56*d9f75844SAndroid Build Coastguard Worker 57*d9f75844SAndroid Build Coastguard Worker } // namespace webrtc 58