Crash in "gnome-terminal --preferences" due to downstream patch

Bug #1745825 reported by Egmont Koblinger on 2018-01-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-terminal (Ubuntu)

Bug Description

When gnome-terminal is _not_ running, execute the command

  gnome-terminal --preferences

Select the Profiles tab, and click on Edit to edit whichever profile.

gnome-terminal crashes.

The main idea behind "gnome-terminal --preferences" is that if someone screws up their gnome-terminal configuration big time (e.g. set a custom command that fails), they can fix it. This crash makes it impossible using this convenient approach.

The crash is not present in upstream gnome-terminal, it is caused by the transparency patch. 0001-Restore-transparency.patch adds this snippet to src/profile-editor.c:

  gtk_widget_style_get (GTK_WIDGET (
              terminal_window_get_active (TERMINAL_WINDOW (transient_parent))),
                        "background-darkness", &style_darkness,

transient_parent is NULL in this case, and terminal_window_get_active() is not prepared for that.

Crash is present in Artful (3.24.2-0ubuntu4) as well as current Bionic (3.26.2-3ubuntu1). Xenial is not affected because the cmdline option --preferences didn't exist back then.

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: gnome-terminal 3.24.2-0ubuntu4
ProcVersionSignature: Ubuntu 4.13.0-32.35-generic 4.13.13
Uname: Linux 4.13.0-32-generic x86_64
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
CurrentDesktop: Unity:Unity7:ubuntu
Date: Sun Jan 28 11:51:23 2018
InstallationDate: Installed on 2016-11-09 (444 days ago)
InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
SourcePackage: gnome-terminal
UpgradeStatus: Upgraded to artful on 2017-09-21 (128 days ago)

Egmont Koblinger (egmont-gmail) wrote :
Egmont Koblinger (egmont-gmail) wrote :

Given the existence of this cmdline option, the approach the transparency patch takes here (locating a terminal window) is broken by design.

One possibility would be to no longer rely on the transient parent (and not set that property either), but instead figure out the value of background-darkness without having access to a terminal window.

The last time I looked at GTK+'s API, it seemed pretty easy to build up an imaginary node with imaginary widgets of certain CSS classes/names along its path, and query its style. I've never done it, though.

Another, probably simpler and cleaner solution would be to redesign the Preferences UI not to require knowing this value.

Gnome-terminal's Preferences UI had several changes throughout the years, and they went in the direction of simplification, and squeezing into a simple line the features that really don't require two lines. E.g. it used to have

  [x] Use the system fixed with font
  Font: [Monospace 9]

and now it has

  [x] Custom font: [Monospace 9]

Transparency also occupies two lines:

  [x] Use transparent background: none --o----- full
  [x] Use transparency from system theme

The second one is only shown if the system theme defines a level of transparency, as for example Ubuntu's default Ambiance does, while GTK+'s default Adwaita doesn't. Detecting this is what causes the crash, so would be nice not to require knowing. (On a side note, the first option is insensitive if the second one is checked, which means the two lines should really be swapped.)

My recommendation, in the spirit of Font's simplification on the UI:

  [x] Custom transparency: none --o----- full

When unchecked, the transparency defined by the theme would be used (which may be translucent, or may be fully opaque). When checked, the slider becomes sensitive and its setting is used instead of the theme's. There's no need for an explicit checkbox to disable/enable transparency, disabling it can simply be achieved by sliding the slider all the way to the left.

This would also require reducing the number of dconf options from 3 to 2, which is again IMHO a nice simplification (although ideally a one-shot migration should be performed).

Egmont Koblinger (egmont-gmail) wrote :

Looking a bit into the near future:

gnome-terminal 3.27.90, released in a week, is most likely going to receive a big change to the Preferences dialogs (

I've already prepared porting the transparency patch, except for this part. I have no intention to port a code that's buggy by design and hence necessarily buggy by implementation. I'll skip the offending part in my patch and just unconditionally show the second config option too.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-terminal - 3.27.90-1ubuntu1

gnome-terminal (3.27.90-1ubuntu1) bionic; urgency=medium

  [ Jeremy Bicha ]
  * Merge with Debian (LP: #1744711). Remaining changes:
    + debian/rules:
      - Install compatibility version of gnome-terminal.desktop
    + gnome-terminal.wrap, debian/rules:
      - Add a wrapper script to restore command line compatibility.
    + debian/
      - gnome-terminal depends on python3, python3-gi and gir1.2-glib-2.0 for
        the wrapper script.
      - Don't Build-Depend on PCRE2
    + Add 0001-Restore-transparency.patch:
      - Restore transparency support
    + Add 0001-Add-style-classes-and-CSS-names-to-some-of-our-widge.patch:
      - Add CSS names and style classes so we can theme things more easily.
    + Add 0001-screen-window-Extra-padding-around-transparent-termi.patch:
      - Fix transparency on Wayland. Patch by Owen Taylor, via Debarshi Ray @
        Fedora (LP: #1650395)
    + Add 50_add_unity_quicklist.patch:
      - Add Unity quicklist menu item.
    + Add 52_support_apturl.patch:
      - Support apt: urls.
    + Add 60_add_lp_handler.patch:
      - Add a handler for launchpad bug URLs.
    + Add scrollbar-background-theming.patch:
      - Draw background under the scrollbar that matches the actual terminal
        background color. This allows proper theming.
    + Add debian/patches/revert-pcre2.patch:
      - Revert changes that require PCRE2 since it's not in main
        (see MIR #163666)

  [ Egmont Koblinger ]
  * Update patches to apply against new version
  * Always show "Use transparency from system theme" checkbox (LP: #1745825)

gnome-terminal (3.27.90-1) experimental; urgency=medium

  * New upstream development release
    - Unified preferences dialog
  * Bump minimum libvte-2.91-dev to 2.51.3
  * Drop obsolete vala build-dependency

 -- Egmont Koblinger <email address hidden> Fri, 16 Feb 2018 13:09:20 -0500

Changed in gnome-terminal (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.