Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes X when opening in gvim from XFCE #140

Closed
perrin4869 opened this issue Apr 25, 2015 · 8 comments
Closed

Crashes X when opening in gvim from XFCE #140

perrin4869 opened this issue Apr 25, 2015 · 8 comments

Comments

@perrin4869
Copy link

This is one of the most random bugs I have ever seen, but I could trace it back to a certain commit in tcomment. When opening gvim with tcomment from XFCE (as far as I remember, it actually didn't occur in KDE) other than from command line (for example, from thunar or from cairo-dock), X crashes and must be turned off with Ctrl+Alt+Backspace
I removed all the vim plugins in my dotfiles repository and brought them back one by one. The crash happened when tcomment was added. I left tcomment alone with pathogen, and the crash persisted. By checking out older commits, I traced the bug back to commit 16f4229... I have no idea what is causing it, but happened in both my old installation and the Slackware box I just reinstalled
Please tell me if there is any more information I can provide to help get this bug down!

@tomtom
Copy link
Owner

tomtom commented Apr 25, 2015

I'm wondering what is actually "crashing". X doesn't seem to crash since
that would result in a restart or in you ending up on the command line.
Could it simply be GVIM has 100% CPU usage when this happens? Do you use
the gtk+ gui? Can you update gvim or the gui toolkit? I personally use
gtk2-gnome gui with ubuntu and don't experience any problems.

I don't see how the changes in the patch you mention should affect
anything outside of gvim unless it triggers a bug in the gvim gui you
use or the gui toolkit.

You could try to find out the plug map that triggers the problem (:map
TComment_gc) and then run the command by hand to find out what
actually causes the problem.

If you remove "call tcomment#ResetOption() |" from line 183 the problem
persists?

Sorry for this slightly unhelpful response.

@perrin4869
Copy link
Author

Thank you for the response!
Indeed, what happens is that as soon as I open gVim xfce freezes and all I can do is move the mouse, go into another tty or just bring X down with Ctrl+Alt+Backspace. Even if I close gvim from a tty command line and I go back to XFCE, it becomes all black and there's nothing else to do other than bring X down.

Since the bug triggers as soon as I open gVim, so it is not a plug map that is the problem. I also removed the call you mentioned above, but the problem persists...

@tomtom
Copy link
Owner

tomtom commented Apr 26, 2015

Since the bug triggers as soon as I open gVim, so it is not a plug map
that is the problem. I also removed the call you mentioned above, but
the problem persists...

Then tcomment isn't the problem, is it? tcomment doesn't do anything
unless you invoke some map.

@perrin4869
Copy link
Author

Played around with this some more, and I managed to find the line that caused the problem!
Checked out the commit before 16f4229, 5fc66e0, and changed line 170 on plugin/tcomment.vim to \ a:name, opfunc, a:invoke) (as in commit 16f4229)... and when I tried to open gVim, it crashed. Hope this is more helpful!
Also, well, tcomment is the problem since everything is fixed if I either remove tcomment or checkout a commit earlier than 16f4229

@tomtom
Copy link
Owner

tomtom commented Apr 26, 2015

Simply loading gvim causes the problem?

Since I have no way to reproduce the problem, I can only speculate about
it's cause. SInce the problem seems to be with gvim, maybe some
environment variable (which could also explain the different behaviour
depending on how you start gvim) could cause the problem.

If you're willing to investigate this further, you could print the
arguments to s:MapOp() to find out if a specific map triggers the
problem. Otherwise I don't think I can do much about it though. Sorry.

@tomtom
Copy link
Owner

tomtom commented Apr 26, 2015 via email

@perrin4869
Copy link
Author

nah, wouldn't want such hack on the plugin's code, but thanks!
I am very much inexperienced in vimscript so it's not easy for me to investigate... but adding an echo to the body of the function I can immediately see that it was called a couple of times upon vim startup. Here are the results of adding echo statement after the exec printf call:

a:name Uncomment a:op tcomment#OperatorAnyway extra  \| call tcomment#SetOption("mode_extra", "U") a:invoke g@
a:name Uncommentc a:op tcomment#OperatorLineAnyway extra  \| call tcomment#SetOption("mode_extra", "U") a:invoke g@$
a:name Uncommentb a:op tcomment#OperatorLine extra  \| call tcomment#SetOption("mode_extra", "UB") a:invoke g@
a:name Comment a:op tcomment#OperatorAnyway extra  a:invoke g@
a:name Commentc a:op tcomment#OperatorLineAnyway extra  a:invoke g@$
a:name Commentb a:op tcomment#OperatorLine extra  \| call tcomment#SetOption("mode_extra", "B") a:invoke g@
a:name gcc a:op tcomment#OperatorLine extra  a:invoke g@$
a:name gcb a:op tcomment#OperatorLine extra  \| call tcomment#SetOption("mode_extra", "B") a:invoke g@
a:name gc a:op tcomment#Operator extra  a:invoke g@
a:name gc1c a:op tcomment#Operator extra  a:invoke g@
a:name gc2c a:op tcomment#Operator extra  a:invoke g@
a:name gc3c a:op tcomment#Operator extra  a:invoke g@
a:name gc4c a:op tcomment#Operator extra  a:invoke g@
a:name gc5c a:op tcomment#Operator extra  a:invoke g@
a:name gc6c a:op tcomment#Operator extra  a:invoke g@
a:name gc7c a:op tcomment#Operator extra  a:invoke g@
a:name gc8c a:op tcomment#Operator extra  a:invoke g@
a:name gc9c a:op tcomment#Operator extra  a:invoke g@

Is there a better way I could debug this?

I'll keep investigating this further for sure... it's really weird!

@perrin4869
Copy link
Author

OK, I found something new! Checked out commit 16f4229 and started searching for the problem line from that side... and the thing is, even if I removed the exec printf line, gvim would freeze if called from gui... looking a bit further into it, turns out that the culprit line is 177, @t! If I remove it, the problem vanishes. Changing it to echo @t still freezes xfce when called from gui, but calling it from the command line outputs:

 perrin4869@landau  ~  \gvim                                                                                                                                                                                                               
function! TCommentOpFunc_Uncomment(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_Uncomment')
call tcomment#SetOption("mode_extra", "U")
return call('tcomment#OperatorAnyway', a:000)
endf
function! TCommentOpFunc_Uncommentc(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_Uncommentc')
call tcomment#SetOption("mode_extra", "U")
return call('tcomment#OperatorLineAnyway', a:000)
endf
function! TCommentOpFunc_Uncommentb(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_Uncommentb')
call tcomment#SetOption("mode_extra", "UB")
return call('tcomment#OperatorLine', a:000)
endf
function! TCommentOpFunc_Comment(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_Comment')

return call('tcomment#OperatorAnyway', a:000)
endf
function! TCommentOpFunc_Commentc(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_Commentc')

return call('tcomment#OperatorLineAnyway', a:000)
endf
function! TCommentOpFunc_Commentb(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_Commentb')
call tcomment#SetOption("mode_extra", "B")
return call('tcomment#OperatorLine', a:000)
endf
function! TCommentOpFunc_gcc(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gcc')

return call('tcomment#OperatorLine', a:000)
endf
function! TCommentOpFunc_gcb(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gcb')
call tcomment#SetOption("mode_extra", "B")
return call('tcomment#OperatorLine', a:000)
endf
function! TCommentOpFunc_gc(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc1c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc1c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc2c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc2c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc3c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc3c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc4c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc4c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc5c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc5c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc6c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc6c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc7c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc7c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc8c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc8c')

return call('tcomment#Operator', a:000)
endf
function! TCommentOpFunc_gc9c(...)
call tcomment#MaybeReuseOptions('TCommentOpFunc_gc9c')

return call('tcomment#Operator', a:000)
endf

going to sleep now... hope this provides a good clue!

@tomtom tomtom closed this as completed in eee4ff4 Apr 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants