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

Close file destroys wrong buffer #114

Open
ricochet1k opened this issue Jul 25, 2016 · 0 comments
Open

Close file destroys wrong buffer #114

ricochet1k opened this issue Jul 25, 2016 · 0 comments
Labels

Comments

@ricochet1k
Copy link
Member

ricochet1k commented Jul 25, 2016

This fix allows the current tab to be the one targeted by typing and commands: limetext/lime-qml@5416f3b
After that commit, it is now possible to crash lime-qml by opening a file, closing an older one and typing in it. It looks like the backend is destroying a buffer it shouldn't when the close command is issued.

Steps to reproduce:

  1. Run lime-qml
  2. Use File ->Open File... to open a file
  3. Click on the first "untitled" tab
  4. Click File -> CloseFile
  5. Type in the newly opened file
[07/25/16 11:07:49] [DEBG] frontend.HandleInput: text=a, key=41, modifiers=0
[07/25/16 11:07:49] [EROR] Panic in RunTextCommand: runtime error: invalid memory address or nil pointer dereference
View{id:10, buffer: %!s(<nil>)} "insert" backend.Args{"characters":"a"}
/home/matt/work/src/github.com/limetext/backend/commandhandler.go:123 (0x5178b5)
    (*commandHandler).RunTextCommand.func1: log.Error("Panic in RunTextCommand: %v\n%v %#v %#v\n%s", r, view, name, args, string(debug.Stack()))
/home/matt/opt/go/src/runtime/asm_amd64.s:437 (0x4bd0ce)
    call32: CALLFN(·call32, 32)
/home/matt/opt/go/src/runtime/panic.go:423 (0x48d709)
    gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/home/matt/opt/go/src/runtime/panic.go:42 (0x48bdc9)
    panicmem: panic(memoryError)
/home/matt/opt/go/src/runtime/sigpanic_unix.go:24 (0x4a246a)
    sigpanic: panicmem()
/home/matt/work/src/github.com/limetext/backend/view.go:989 (0x514bd4)
    (*View).ChangeCount: return v.buffer.ChangeCount()
/home/matt/work/src/github.com/limetext/backend/edit.go:34 (0x4fd090)
    newEdit: savedCount: v.ChangeCount(),
/home/matt/work/src/github.com/limetext/backend/view.go:395 (0x50e615)
    (*View).BeginEdit: e := newEdit(v)
/home/matt/work/src/github.com/limetext/backend/view.go:605 (0x51166d)
    (*View).runCommand: e := v.BeginEdit()
/home/matt/work/src/github.com/limetext/backend/commandhandler.go:139 (0x4fb1db)
    (*commandHandler).RunTextCommand: } else if err := view.runCommand(c, name); err != nil {
/home/matt/work/src/github.com/limetext/backend/editor.go:337 (0x518fda)
    (*Editor).inputthread.func1: if err := e.CommandHandler().RunTextCommand(v, "insert", Args{"characters": kp.Text}); err != nil {
/home/matt/work/src/github.com/limetext/backend/editor.go:344 (0x5026e1)
    (*Editor).inputthread: doinput(kp)
/home/matt/opt/go/src/runtime/asm_amd64.s:1721 (0x4bf421)
    goexit: BYTE    $0x90   // NOP

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/36333201-close-file-destroys-wrong-buffer?utm_campaign=plugin&utm_content=tracker%2F15716642&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F15716642&utm_medium=issues&utm_source=github).
@zoli zoli added the bug label Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants