Crash when changing file type to "Default style" in "Other"

Bug #1745346 reported by Vitaliy Kanev
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mousepad
Fix Released
Medium
mousepad (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Steps to reproduce
------------------

1. Type some text
2. In the "Document" menu, select "File type" -> "Other" -> "Default Style"

Expected Result
---------------

No crash, document type changed

Actual result
-------------

Crash, document type not changed

Version
-------

Xubuntu 17.10.1, Mousepad 0.4.0

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: mousepad 0.4.0-4ubuntu1
ProcVersionSignature: Ubuntu 4.13.0-31.34-generic 4.13.13
Uname: Linux 4.13.0-31-generic x86_64
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
CurrentDesktop: XFCE
Date: Thu Jan 25 13:30:48 2018
InstallationDate: Installed on 2018-01-18 (6 days ago)
InstallationMedia: Xubuntu 17.10 "Artful Aardvark" - Release amd64 (20180105)
SourcePackage: mousepad
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
In , bilka (bilka412) wrote :

Mousepad crashes when I click on "Document" > "Type de fichier" > "Others" > "Defaults"

I guess in english it is labeled "Document" > "File Type" > "Others" > "Defaults", my system is Debian 8 with XFCE in french.

Hope this will help.

Revision history for this message
In , G-matt-8 (g-matt-8) wrote :

Confirmed, it does it here to. I have no idea what file type "Defaults" is supposed to be. Will have a look and see why it's crashing.

Revision history for this message
In , Andreldm-2 (andreldm-2) wrote :

Yeah, this crashes here when the editor is not empty.
GtkSourceView:ERROR:gtksourcecontextengine.c:5902:update_syntax: assertion failed: (state->context != NULL)
Aborted (core dumped)

Mousepad 0.4.0 GTK+2 from Arch Repo.

Revision history for this message
In , G-matt-8 (g-matt-8) wrote :

I tried looking into a bit but I haven't yet installed the sources for the GtkSourceView version on my machine.

I wonder if "Defaults" is some weird file type we should just skip/hide/disable it? I don't see it in Gedit's file type selection menu.

Revision history for this message
In , Andreldm-2 (andreldm-2) wrote :

I'm taking a look at this, so far this is where the crash happens:

GTK2:
https://github.com/GNOME/gtksourceview/blob/gnome-2-30/gtksourceview/gtksourcecontextengine.c#L5902

GTK3:
https://github.com/GNOME/gtksourceview/blob/gnome-3-16/gtksourceview/gtksourcecontextengine.c#L5468

It's weird because in GTK2 there is only "Others", but in GTK3 there is "Others->Default" and "Other->..."

Revision history for this message
In , G-matt-8 (g-matt-8) wrote :

Ahhh ... it's a special base language definition, not a real language:

https://git.gnome.org/browse/gtksourceview/tree/data/language-specs/def.lang

Judging by the `hidden=true` attribute in the XML and the existence of this function:

https://developer.gnome.org/gtksourceview/stable/GtkSourceLanguage.html#gtk-source-language-get-hidden

I guess we shouldn't be showing it, but rather checking for non-hidden filetypes to show.

Revision history for this message
In , Andreldm-2 (andreldm-2) wrote :

Created attachment 6368
Quick patch

Yep, I wrote this quick patch and it seems to work.

Revision history for this message
In , Andreldm-2 (andreldm-2) wrote :

Created attachment 6369
Improved patch

Tested on GTK2 and GTK3.

Revision history for this message
In , G-matt-8 (g-matt-8) wrote :

Thanks André, merged as http://git.xfce.org/apps/mousepad/commit/?id=720cf91f7b21864b4d3bb0ce18d96cfa719877ca

blk, if it still gives any grief, feel free to re-open.

Revision history for this message
Vitaliy Kanev (vitalkanev) wrote :
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mousepad (Ubuntu):
status: New → Confirmed
Changed in mousepad:
importance: Unknown → Medium
status: Unknown → Fix Released
Changed in mousepad (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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