Closed dg14 closed 3 years ago
Greetings, sure, it seems we're not handling nullable function arguments propertly, so passing a null child_setup
argument to terminal.spawnSync()
causes a segfault.
It should be a quick fix, I'll add it in the next release. Meanwhile, you can pass an placeholder function as a workaround for the issue. The code below runs correctly on my machine:
/*
* segfault-277.js
*/
const gi = require('node-gtk')
const Gdk = gi.require('Gdk', '3.0')
const Gtk = gi.require('Gtk', '3.0')
const GLib = gi.require('GLib', '2.0')
const Vte = gi.require('Vte', '2.91');
Gtk.init([]);
const window = new Gtk.Window({title: 'Ether Terminal'});
const terminal = new Vte.Terminal();
const rGBA = new Gdk.RGBA({red:0, green: 0, blue: 0, alpha: 0.25})
terminal.setCanFocus(true);
terminal.setAllowBold(true);
terminal.setScrollOnOutput(true);
terminal.setScrollOnKeystroke(true);
terminal.setScrollbackLines(8096);
terminal.setColorBackground(rGBA);
terminal.spawnSync(
Vte.PtyFlags.DEFAULT,
GLib.getHomeDir(),
['/bin/bash'],
null,
GLib.SpawnFlags.SEARCH_PATH,
() => {}, // placeholder for child_setup
null
)
window.add(terminal);
window.showAll();
Gtk.main();
Thanks for the report.
hi, i'm trying to use vte but this simple code give me a segfault:
const gi = require('node-gtk') const Gdk = gi.require('Gdk', '3.0') const Gtk = gi.require('Gtk', '3.0') const GLib = gi.require('GLib', '2.0') const Vte = gi.require('Vte', '2.91'); Gtk.init(null); var window = new Gtk.Window({title: 'Ether Terminal'}); var terminal = new Vte.Terminal(); const rGBA = new Gdk.RGBA({red:0, green: 0, blue: 0, alpha: 0.25}) terminal.setCanFocus(true); terminal.setAllowBold(true); terminal.setScrollOnOutput(true); terminal.setScrollOnKeystroke(true); terminal.setScrollbackLines(8096); terminal.setColorBackground(rGBA); terminal.spawnSync(Vte.PtyFlags.DEFAULT, GLib.getHomeDir(), ['/bin/bash'], null, GLib.SpawnFlags.SEARCH_PATH, null, null window.add(terminal); window.showAll(); Gtk.main();
could you check why?