Open syndtr opened 11 years ago
Could you please confirm that you're using the latest commit? My guess is that this bug was fixed in #5 (commit eb7c38953b074e33f86861a3da4c05623cd44fc6).
This seems to fix it:
Sadly, that is not a fix. sync/sync.go
(along with almost everything else) is automatically generated by xgb/xgbgen
. The only code not automatically generated is xgbgen
itself and the base xgb
module.
If you are on the latest commit and still getting this panic, could you please produce a code sample (preferably minimal) that provokes this error?
I'm on the latest commit.
Here you go:
package main
import (
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/sync"
"log"
)
func main() {
X, err := xgb.NewConn()
if err != nil {
log.Fatal(err)
}
if err := sync.Init(X); err != nil {
log.Fatal(err)
}
_, err = sync.ListSystemCounters(X).Reply()
if err != nil {
log.Fatal(err)
}
}
While the fix presented here will work, the problem is that the code being patched is auto-generated. The bug should be fixed in the generator.
However, in the protocol specification for the SYSTEMCOUNTER
type, the padding is computed on the length of the name and the name itself, combined. But the XML description doesn't specify this. So I'm not sure how to discover this fact. I think we'd need to ask the XCB folks (or dig into their generator).
Note that the sync
extension has been removed from XGB until the generator supports the switch
XML field. (A use of the switch
field has been added to the XML recently.)
This seems to fix it: