views:

56

answers:

3

When I run gVim from Terminal in Ubuntu 10.04 with Gnome I get this error:

(gvim:6226): GLib-GObject-CRITICAL **: g_object_ref: assertion `object->ref_count > 0' failed

It looks like that everytime except that the number in between the parans (gvim: ) is always slightly different. How can I fix this with out having to run

gksudo gvim

?

which by the way starts gVim with out loading my .vimrc file and which is also annoying because of having to enter the password everytime.

+1  A: 

If it runs as root I think the problem is with your ~/.vimrc. Try vim -u NONE and if starts review your .vimrc. You may check permissions also.

kfl62
A: 

Since gksudo gvim runs gvim as root it will not load the .vimrc in your home directory but rather the .vimrc in /root (if any).

So the problem is either in your ~/.vimrc or gksudo does not redirect the standard error stream.

Unfortunately, versions of gvim that are shipped with Ubuntu for example are known to spew GTK/GLib errors. I use the following alias in ~/.bashrc to ignore them:

alias gvim="gvim $@ &> /dev/null"
Ton van den Heuvel
Since the Debian/Ubuntu packages don't deviate from upstream at all when it comes to the gui_gtk* source files, this isn't anything specific to Ubuntu's gvim. It's probably related to the specific version of the glib/gtk libraries that are being used.
jamessan
@Ton van den Heuvel Where in the .bashrc should I place that line?
J3M 7OR3
@jamessan how would you suggest fixing this? install a different version of glib/gtk? I upgrade in terminal all the time. Not sure what else to do.
J3M 7OR3
@J3M 7OR3, doesn't matter for the final result, I would place it along with the other alias definitions. Note that you need to login / logout or do `source ~/.bashrc` from your terminal to be able to use the alias.
Ton van den Heuvel
A: 

Apparently I think the issue was in the blackboard.vim colorscheme I was using. I switched from this version of blackboard.vim

http://www.vim.org/scripts/script.php?script_id=2280

to this version

http://concisionandconcinnity.blogspot.com/2009/07/vim-part-i-improved-python-syntax.html

Now it works fine without any error.

J3M 7OR3