Skip to content

gst/log: accept non-ref obj in macros

François Laignel requested to merge fengalin/gstreamer-rs:log-accept-obj into main

... so that when the obj is not a reference, we don't need to use:

    gst::log!(CAT, obj: &obj, "message");

No regression on gst-plugins-rs. See update example in ts-udpsink: fengalin/gst-plugins-rs@546790bf

Only thing I needed to change was a log in gst-base/src/subclass/base_transform.rs due to:

error[E0716]: temporary value dropped while borrowed
    --> gstreamer-base/src/subclass/base_transform.rs:1333:18
     |
1331 | /         gst::warning!(
1332 | |             gst::CAT_RUST,
1333 | |             obj: imp.instance().unsafe_cast_ref::<BaseTransform>(),
     | |                  ^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
1334 | |             "buffer {:?} not writable",
1335 | |             outbuf
1336 | |         );

The #[allow(unused_unsafe)] is necessary to silence a warning when a log marcro is used within an unsafe block.

Merge request reports

Loading