summaryrefslogtreecommitdiff
path: root/fluid/tools
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/tools')
-rw-r--r--fluid/tools/ExternalCodeEditor_UNIX.cxx7
-rw-r--r--fluid/tools/ExternalCodeEditor_UNIX.h2
2 files changed, 6 insertions, 3 deletions
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\"",
diff --git a/fluid/tools/ExternalCodeEditor_UNIX.h b/fluid/tools/ExternalCodeEditor_UNIX.h
index dfcc1e785..0542a5e94 100644
--- a/fluid/tools/ExternalCodeEditor_UNIX.h
+++ b/fluid/tools/ExternalCodeEditor_UNIX.h
@@ -24,7 +24,7 @@ class ExternalCodeEditor {
time_t file_mtime_; // last modify time of the file (used to determine if file changed)
size_t file_size_; // last file size (used to determine if changed)
const char *filename_;
- std::string command_line_;
+ char *command_line_;
int last_error_;
int alert_pipe_[2];
bool alert_pipe_open_;