From c19f34db2f4a64326d03cee7edae095051660f65 Mon Sep 17 00:00:00 2001 From: maxim nikonov Date: Fri, 6 Feb 2026 02:49:13 +0500 Subject: wip --- fluid/tools/ExternalCodeEditor_UNIX.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fluid/tools/ExternalCodeEditor_UNIX.cxx') diff --git a/fluid/tools/ExternalCodeEditor_UNIX.cxx b/fluid/tools/ExternalCodeEditor_UNIX.cxx index 60ed16814..1d1efc462 100644 --- a/fluid/tools/ExternalCodeEditor_UNIX.cxx +++ b/fluid/tools/ExternalCodeEditor_UNIX.cxx @@ -62,6 +62,7 @@ ExternalCodeEditor::ExternalCodeEditor() { filename_ = 0; file_mtime_ = 0; file_size_ = 0; + command_line_ = 0; alert_pipe_[0] = alert_pipe_[1] = -1; alert_pipe_open_ = false; } @@ -76,6 +77,7 @@ ExternalCodeEditor::~ExternalCodeEditor() { (void*)this, (long)pid_); close_editor(); // close editor, delete tmp file set_filename(0); // free()s filename + if (command_line_) free(command_line_); if (alert_pipe_open_) { Fl::remove_fd(alert_pipe_[0]); @@ -389,7 +391,8 @@ int ExternalCodeEditor::start_editor(const char *editor_cmd, editor_cmd, filename); char cmd[1024]; snprintf(cmd, sizeof(cmd), "%s %s", editor_cmd, filename); - command_line_ = editor_cmd; + if (command_line_) free(command_line_); + command_line_ = fl_strdup(editor_cmd); open_alert_pipe(); // Fork editor to background.. switch ( pid_ = fork() ) { @@ -564,7 +567,7 @@ void ExternalCodeEditor::alert_pipe_cb(FL_SOCKET s, void* d) { self->last_error_ = 0; if (::read(s, &self->last_error_, sizeof(int)) != sizeof(int)) return; - const char* cmd = self->command_line_.c_str(); + const char* cmd = self->command_line_; if (cmd && *cmd) { if (cmd[0] == '/') { // is this an absolute filename? fl_alert("Can't launch external editor '%s':\n%s\n\ncmd: \"%s\"", -- cgit v1.2.3