Skip to content
Browse files

externalapp: use os.startfile on windows

Use the nonportable os.startfile() way of working on Windows to workaround
a segfault. Users will no longer be offered a choice of what to launch on
that platform: use Explorer to set the default edit association for the
extension you want to edit instead.

Addresses #531 enough to have it not hinder the release, but
this is a pretty silly workaround for an upstream GLib/GDK regression.
  • Loading branch information...
achadwick committed Dec 18, 2015
1 parent 8059e64 commit abdaf83e81cfa5dcc59a0f8c5671ca0e7153d7ce
Showing with 22 additions and 0 deletions.
  1. +22 −0 gui/
@@ -17,6 +17,7 @@
logger = logging.getLogger(__name__)
import weakref
import os.path
import os

from lib.gettext import gettext as _
from lib.gettext import C_
@@ -229,6 +230,25 @@ def begin(self, layer):
except AttributeError:
file_path = new_edit_tempfile()
if == 'nt':
self._begin_file_edit_using_startfile(file_path, layer)
# Avoid segfault:
# Upstream:
self._begin_file_edit_using_gio(file_path, layer)
self._begin_file_monitoring_using_gio(file_path, layer)

def _begin_file_edit_using_startfile(self, file_path, layer):"Using os.startfile() to edit %r", file_path)
os.startfile(file_path, "edit")
app_name = "(unknown Win32 app)", # FIXME: needs i18n
layer_name =,

def _begin_file_edit_using_gio(self, file_path, layer):"Using OpenWithDialog and GIO to open %r", file_path)
logger.debug("Querying file path for info")
file = Gio.File.new_for_path(file_path)
flags = Gio.FileQueryInfoFlags.NONE
@@ -279,6 +299,8 @@ def begin(self, layer):

def _begin_file_monitoring_using_gio(self, file_path, layer):
logger.debug("Begin monitoring %r for changes (layer=%r)",
file_path, layer)

0 comments on commit abdaf83

Please sign in to comment.
You can’t perform that action at this time.