Avoid g_clear_object in pipewire
Fixes the below build warnings when building with a newer version of
glib. Seen when updating the linux sysroots for crbug.com/1012850
[ 11629/38237 - 588 process @ 649.7/s : 17.899s ] CXX obj/third_party/webrtc/modules/desktop_capture/desktop_capture_generic/base_capturer_pipewire.o
../../third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc:253:5: warning: Not available before 2.34 [-W#pragma-messages]
g_clear_object(&cancellable_);
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/gobject/gobject.h:678:36: note: expanded from macro 'g_clear_object'
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gmem.h:142:3: note: expanded from macro 'g_clear_pointer'
GLIB_AVAILABLE_MACRO_IN_2_34
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gversionmacros.h:473:49: note: expanded from macro 'GLIB_AVAILABLE_MACRO_IN_2_34'
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gmacros.h:991:41: note: expanded from macro 'GLIB_UNAVAILABLE_MACRO'
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gmacros.h:988:33: note: expanded from macro '_GLIB_GNUC_DO_PRAGMA'
^
<scratch space>:249:6: note: expanded from here
GCC warning "Not available before " "2" "." "34"
^
../../third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc:257:5: warning: Not available before 2.34 [-W#pragma-messages]
g_clear_object(&proxy_);
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/gobject/gobject.h:678:36: note: expanded from macro 'g_clear_object'
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gmem.h:142:3: note: expanded from macro 'g_clear_pointer'
GLIB_AVAILABLE_MACRO_IN_2_34
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gversionmacros.h:473:49: note: expanded from macro 'GLIB_AVAILABLE_MACRO_IN_2_34'
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gmacros.h:991:41: note: expanded from macro 'GLIB_UNAVAILABLE_MACRO'
^
../../build/linux/debian_sid_amd64-sysroot/usr/include/glib-2.0/glib/gmacros.h:988:33: note: expanded from macro '_GLIB_GNUC_DO_PRAGMA'
^
<scratch space>:254:6: note: expanded from here
GCC warning "Not available before " "2" "." "34"
^
2 warnings generated.
BUG=chromium:1012850, chromium:1014947
R=tommi@webrtc.org
Change-Id: I0f72e1cd6e9b9311cf2cbd5635e7ad8fe489c350
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156980
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29506}
diff --git a/modules/desktop_capture/linux/base_capturer_pipewire.cc b/modules/desktop_capture/linux/base_capturer_pipewire.cc
index e4f7d86..2640e93 100644
--- a/modules/desktop_capture/linux/base_capturer_pipewire.cc
+++ b/modules/desktop_capture/linux/base_capturer_pipewire.cc
@@ -250,11 +250,13 @@
if (cancellable_) {
g_cancellable_cancel(cancellable_);
- g_clear_object(&cancellable_);
+ g_object_unref(cancellable_);
+ cancellable_ = nullptr;
}
if (proxy_) {
- g_clear_object(&proxy_);
+ g_object_unref(proxy_);
+ proxy_ = nullptr;
}
}