Skip to content

Segfault when using callbacks in Ubuntu 26.04 #390

@chfritz

Description

@chfritz

I've now seen two separate situations where using a callback function causes a segfault on Ubuntu 26, when the same callbacks worked fine on Ubuntu 20.04 - 24.04. They are both in a gstreamer context:

  1. somePad.addProbe(Gst.PadProbeType.BUFFER, () => { ... });
  2. Gst.Promise.newWithChangeFunc((promise) => { ... })

I have a workarounds for the latter using a Promise without a callback and .wait()-ing for it instead, not sure there is a workaround for the pad probes though.

Here is a minimal reproducible example for the second one:

gi = require('node-gtk')
Gst = gi.require('Gst', '1.0');

gi.startLoop();
Gst.init([]);

pipeline = Gst.parseLaunch('videotestsrc is-live=true ! x264enc ! rtph264pay ! webrtcbin name=webrtc');
const result = pipeline.setState(Gst.State.PLAYING);
const webrtcbin = pipeline.getByName(`webrtc`);

// segfaults on Ubuntu 26 when the callback _triggers_:
webrtcbin.emit('create-offer', Gst.Structure.newIdEmpty(1),
  Gst.Promise.newWithChangeFunc((promise) => {}) 
);

// this works:
// const promise = Gst.Promise.new()
// webrtcbin.emit('create-offer', structure, promise);
// promise.wait();

// keep alive
setInterval(() => {}, 1000);

console.log('done');
$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 26.04 LTS"

$ node --version
v20.12.1

PS: same on nodejs v24.15.0. All tested on node-gtk@1.0.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions