(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.
https://git.xfce.org/apps/mousepad/tree/mousepad/mousepad-window.c#n2358 Replacing "g_object_ref (language)" with just "language" resolves the bug.
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
(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.
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.
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
Thanks.