! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Error message when opening File menu
Status:
RESOLVED: FIXED
Product:
Mousepad
Component:
General

Comments

Description Theo Linkspfeifer editbugs 2019-04-22 11:28:36 CEST
(mousepad:1932): GLib-GObject-CRITICAL **: 11:18:00.817: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

This error message is printed X times when one opens the File menu. X is determined by the amount of Template files.
Comment 1 Theo Linkspfeifer editbugs 2019-04-22 11:35:16 CEST
https://git.xfce.org/apps/mousepad/tree/mousepad/mousepad-window.c#n2358

Replacing "g_object_ref (language)" with just "language" resolves the bug.
Comment 2 Theo Linkspfeifer editbugs 2019-04-22 13:52:48 CEST
Furthermore, when using the "New From Template" sub menu to create a new file, this message appears in the terminal output:

(mousepad:3744): Mousepad-CRITICAL **: 13:40:50.177: mousepad_file_guess_language: assertion '(file->filename != NULL)' failed
Comment 3 Andre Miranda editbugs 2019-04-23 14:13:18 CEST
(In reply to Theo Linkspfeifer from comment #1)
> https://git.xfce.org/apps/mousepad/tree/mousepad/mousepad-window.c#n2358
> 
> Replacing "g_object_ref (language)" with just "language" resolves the bug.

I don't think that's a proper fix, the problem is why "language" is NULL. If it's expected to be NULL sometimes then it should checked and g_object_ref avoided.
Comment 4 Theo Linkspfeifer editbugs 2019-04-23 20:55:51 CEST
Created attachment 8448 
proposed patch

Filetype/language is NULL when it cannot be guessed successfully. This applies to plain text files, OpenDocument templates, and others too. On the other hand, for a bash shell script it can be set.

Furthermore, the filetype/language is already set in mousepad_window_action_new_from_template(), so avoid doing it in mousepad_file_open(). This eliminates the second error.
Comment 5 Git Bot editbugs 2019-04-24 03:36:33 CEST
Theo Linkspfeifer referenced this bugreport in commit 4e814555204a985f2239d946d3b6b49b257aef5b

Only set template filetype when detected (Bug #15314)

https://git.xfce.org/apps/mousepad/commit?id=4e814555204a985f2239d946d3b6b49b257aef5b
Comment 6 Andre Miranda editbugs 2019-04-24 03:37:52 CEST
Thanks.

Bug #15314

Reported by:
Theo Linkspfeifer
Reported on: 2019-04-22
Last modified on: 2019-04-24

People

Assignee:
Matthew Brush
CC List:
2 users

Version

Target Milestone:
Mousepad 0.4.x

Attachments

proposed patch (1.93 KB, patch)
2019-04-23 20:55 CEST , Theo Linkspfeifer
no flags

Additional information