Merge branch '3020_external_editor_segfault'

* 3020_external_editor_segfault:
  --with-edit: rename to --with-internal-edit.
  Fix bug with segfault when we tried to create new file in an external editor (by pressing shift-F4)
  Ticket #3020: segfault on creating new file in external editor
This commit is contained in:
Slava Zanko 2013-07-02 15:32:19 +03:00
commit 368a303d93
9 changed files with 32 additions and 22 deletions

View File

@ -11,7 +11,7 @@ m4_include([m4.include/mc-get-fs-info.m4])
m4_include([m4.include/mc-with-x.m4])
m4_include([m4.include/mc-use-termcap.m4])
m4_include([m4.include/mc-with-screen.m4])
m4_include([m4.include/mc-with-edit.m4])
m4_include([m4.include/mc-with-internal-edit.m4])
m4_include([m4.include/mc-subshell.m4])
m4_include([m4.include/mc-background.m4])
m4_include([m4.include/ac-glib.m4])

View File

@ -383,7 +383,7 @@ dnl ############################################################################
dnl MC options
dnl ############################################################################
MC_WITH_EDIT
MC_WITH_INTERNAL_EDIT
dnl Diff viewer support.
AC_ARG_WITH([diff_viewer],
@ -478,7 +478,7 @@ AC_SUBST(LIBS)
AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
AM_CONDITIONAL(USE_EDIT, [test x"$use_edit" = xyes ])
AM_CONDITIONAL(USE_INTERNAL_EDIT, [test x"$use_internal_edit" = xyes ])
AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])

View File

@ -1,16 +1,18 @@
dnl
dnl Internal editor support.
dnl
AC_DEFUN([MC_WITH_EDIT], [
AC_DEFUN([MC_WITH_INTERNAL_EDIT], [
AC_ARG_WITH([edit], AS_HELP_STRING([--with-edit], [Enable internal editor @<:@yes@:>@]))
AC_ARG_WITH([internal_edit],
AS_HELP_STRING([--with-internal-edit], [Enable internal editor @<:@yes@:>@]))
if test x$with_edit != xno; then
if test x$with_internal_edit != xno; then
AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
use_edit=yes
use_internal_edit=yes
AC_MSG_NOTICE([using internal editor])
edit_msg="yes"
else
use_edit=no
use_internal_edit=no
edit_msg="no"
fi
@ -27,7 +29,7 @@ AC_DEFUN([MC_WITH_EDIT], [
[enable_aspell=no]
)
if test x$with_edit != xno -a x$enable_aspell != xno; then
if test x$with_internal_edit != xno -a x$enable_aspell != xno; then
AC_CHECK_HEADERS([aspell.h], [], [
AC_ERROR([Could not find aspell development headers])
], [])
@ -40,7 +42,5 @@ AC_DEFUN([MC_WITH_EDIT], [
enable_aspell=no
AC_MSG_NOTICE([aspell support is disabled because gmodule support is not available])
fi
else
edit_msg="yes"
fi
])

View File

@ -79,7 +79,7 @@ SYNTAXFILES = \
yum-repo.syntax \
yxx.syntax
if USE_EDIT
if USE_INTERNAL_EDIT
syntaxdir = $(pkgdatadir)/syntax
syntax_DATA = $(SYNTAX_OUT) \
$(SYNTAXFILES)

View File

@ -1,6 +1,6 @@
SUBDIRS = filemanager man2hlp vfs viewer
if USE_EDIT
if USE_INTERNAL_EDIT
SUBDIRS += editor
endif
@ -29,7 +29,7 @@ pkglibexecdir = $(libexecdir)/@PACKAGE@
bin_PROGRAMS = mc
if USE_EDIT
if USE_INTERNAL_EDIT
EDITLIB = editor/libedit.la
endif
@ -90,7 +90,7 @@ EXTRA_DIST = $(SRC_maintainer) $(SRC_charset)
install-exec-hook:
$(MAKE) install_mcview
if USE_EDIT
if USE_INTERNAL_EDIT
$(MAKE) install_mcedit
endif
if USE_DIFF
@ -111,7 +111,7 @@ install_mcdiff:
uninstall-hook:
rm -f $(DESTDIR)$(bindir)/$(binprefix)/mcview
if USE_EDIT
if USE_INTERNAL_EDIT
rm -f $(DESTDIR)$(bindir)/$(binprefix)/mcedit
endif
if USE_DIFF

View File

@ -1,6 +1,6 @@
EXTRA_DIST =
if USE_EDIT
if USE_INTERNAL_EDIT
noinst_LTLIBRARIES = libedit.la
else
noinst_LTLIBRARIES =

View File

@ -633,12 +633,16 @@ execute_external_editor_or_viewer (const char *command, const vfs_path_t * filen
char **argv_cmd_options;
int argv_count;
g_shell_parse_argv (extern_cmd_options, &argv_count, &argv_cmd_options, NULL);
if (g_shell_parse_argv (extern_cmd_options, &argv_count, &argv_cmd_options, NULL))
{
do_executev (command, EXECUTE_INTERNAL, argv_cmd_options);
g_strfreev (argv_cmd_options);
}
else
do_executev (command, EXECUTE_INTERNAL, NULL);
g_free (extern_cmd_options);
do_executev (command, EXECUTE_INTERNAL, argv_cmd_options);
g_strfreev (argv_cmd_options);
}
execute_cleanup_with_vfs_arg (filename_vpath, &localcopy_vpath, &mtime);

View File

@ -790,6 +790,8 @@ do_edit_at_line (const vfs_path_t * what_vpath, gboolean internal, long start_li
else
#endif /* USE_INTERNAL_EDIT */
{
(void) internal;
if (editor == NULL)
{
editor = getenv ("EDITOR");

View File

@ -1,4 +1,8 @@
SUBDIRS = . editor filemanager
SUBDIRS = . filemanager
if USE_INTERNAL_EDIT
SUBDIRS += editor
endif
AM_CPPFLAGS = \
$(GLIB_CFLAGS) \