7

Everytime I close a gvim window with the little x on the window or Alt + F4. I get the following error and have to hit return to get my command prompt back. Has anyone seen this?

(gvim:26639): GLib-GObject-WARNING **: cannot retrieve class for invalid (unclassed) type `<invalid>'
Braiam
  • 66,947
  • 30
  • 177
  • 264
bjackfly
  • 323
  • 3
  • 13

4 Answers4

24

vim-gnome has this problem, but vim-gtk does not, so this is a quick fix for the problem:

sudo apt remove vim-gnome
sudo apt install vim-gtk
Håkon A. Hjortland
  • 3,596
  • 1
  • 27
  • 26
4

Normally, GLib-GObject-WARNING while running gtk applications in the command line, are normally ignored by developers and demonstrate a poorly written applications. If you report a bug against the package, it would be the best, but don't act surprised if developers ignore or say that "is ok" in your bug report.

TL;dr: They are normally safe to be ignored.

Braiam
  • 66,947
  • 30
  • 177
  • 264
1

I found myself caught between the spurious Warning (vim-gnome) or an empty file bug with vim-gtk3. Open an existing file, then try switching to a new file that doesn't exist using

:e newEmptyFile => SEGV

So I'm back to using vim-gnome with this hack in my ~/.bash_aliases to shutup vim-gnome:

alias gvim='gvim 2>/dev/null'

I'm sure it will get fixed soon and I won't have to keep throwing away all errors because of a persistent spurious warning.

swift
  • 3,261
  • 2
  • 22
  • 46
  • Perfect 1 minute solution for a rookie like me :) I tried to replace `vim-gnome` with `viw-gtk` or `vim-gtk3`, but still got the error. The alias is an easy solution. Moreover, if I am not wrong, one still can get error by "canceling" the alias with a backslash `\gvim foo.txt` to call the original `\gvim` application – el-teedee Sep 09 '18 at 01:14
  • You _could_ always pipe the stderr to a `grep -v 'cannot retrieve class for invalid (unclassed) type'` (or more detailed if you like) and get on with your life, no? :) – tgm1024--Monica was mistreated Feb 07 '21 at 18:00
0

Try

sudo update-alternatives --config gvim

then select /usr/bin/vim.gtk-py2

Zanna
  • 69,223
  • 56
  • 216
  • 327