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
Context.SetVar - panic: pre-allocated buffer size was wrong #42
Comments
Yes, I'm pretty sure I know why this is happening. There's a TODO in the code for it which I should have fixed before, sorry about that. Are you able to provide a small example (or any, if a small one isn't doable), so that we can be sure that this is the proper bug being fixed? Thanks. |
I'll gladly provide a small example. I'm new to open source, so please give me a description of what that example would entail. What files/output and in what format would you like to see. I'm a huge fan by the way, Gustavo! |
Thanks! If you can provide either a URL for the source code or just a small tarball or zip file containing an example that would reproduce the issue above, that would be great already. |
OK, I have created a zip file with an explanation of the bugs (there are two), the source code and qml file, a description of my qml install (actually dpkg dump with packages), and a copy of the error message I received from go. Its located here: http://ge.tt/71nzZJK1/v/0?c I commented out the two lines causing the second bug so you could investigate the first one if you wanted. Uncommenting them will give you the second bug. Everything is fully described in bug_report.txt. |
The reported error was indeed the one suspected. I could not reproduce the other issue you mentioned in the text file, though. That said, there's a specific workaround for an upstream issue that resembles very much what you mention. For that reason, the qml package currently triggers a resize event when the window is being shown. It's curious that this isn't working for you. |
Thanks! awesome! |
Hey Gustavo. 2014/02/18 20:35:10 taq.qml:40: file:///home/eb/Dropbox/go/src/taq/taq.qml:40: Unable to assign [undefined] to QUrl so I passed a struct with a string in it: cell1.pic . At least in the go code, that struct and string are definitely not 'undefined', instead when evaluated it gives 'blank.png'. |
That sounds like a non-existing property. Make sure the casing is right. If you cannot figure it out, please link an example and I'll be happy to take a look. |
question: If the struct contains a string field, a la: |
No, it has to be exported.. Pic would work, for example. Note that you'd still refer to it as "pic" from within QML code, though, as that's a requirement for any object properties there. There is a small section in the package documentation at http://godoc.org/github.com/niemeyer/qml that explains the rules ("Lowercasing of names"). |
aaaaaaaaaaaaaaaaaaaaaaaaaaaah. only uppercase Go names are exported. wow. ok, lets try this out... |
Yeah, that's an important rule of package namespacing. You'll face it when dealing with any cross-package code. Note that this includes cases such as marshalling packages (xml, json, etc). |
ok. it works now. yeahhh!!!! tic tac toh baby!!! |
I'm unable to pass a struct via Context.SetVar and access one of its fields in the QML. I've tried passing many different structs to SetVars and calling them from the QML in many ways.
panic: pre-allocated buffer size was wrong
goroutine 4 [running]:
runtime.panic(0x53e340, 0xc21000a300)
/usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/niemeyer/qml.typeInfo(0x55d860, 0xc21001d5d0, 0x55d860)
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/datatype.go:304 +0x7fd
github.com/niemeyer/qml.wrapGoValue(0xc21001d540, 0x55d860, 0xc21001d5d0, 0x1, 0x0)
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/bridge.go:233 +0x40d
github.com/niemeyer/qml.packDataValue(0x55d860, 0xc21001d5d0, 0xc21000a2d0, 0xc21001d540, 0x7fe6a0e09c01)
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/datatype.go:106 +0x21a
github.com/niemeyer/qml.func·013()
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/qml.go:292 +0x84
github.com/niemeyer/qml.hookIdleTimer()
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/bridge.go:172 +0x5b
github.com/niemeyer/qml._Cfunc_applicationExec(0x8c1380)
github.com/niemeyer/qml/_obj/_cgo_defun.c:57 +0x31
github.com/niemeyer/qml.guiLoop()
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/bridge.go:41 +0x5b
created by github.com/niemeyer/qml.Init
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/qml.go:44 +0xa0
goroutine 1 [runnable]:
github.com/niemeyer/qml.gui(0xc21001d600)
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/bridge.go:68 +0xa3
github.com/niemeyer/qml.(*Context).SetVar(0xc21000a2a0, 0x57fd80, 0x5, 0x55d860, 0xc21001d5d0)
/home/eb/Dropbox/go/src/github.com/niemeyer/qml/qml.go:298 +0x10b
main.run(0x7fe6a0e09ed0, 0x2)
/home/eb/Dropbox/go/src/taq/taq.go:90 +0x19d
main.main()
/home/eb/Dropbox/go/src/taq/taq.go:73 +0x31b
goroutine 3 [syscall]:
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1394
exit status 2
the go -code is here:
type Cell struct {
num int
val string
pic string
}
func NewCell(num int) Cell {
return Cell{val: "",num:num,pic:"blank.png"}
}
and the qml file:
Any ideas?
The text was updated successfully, but these errors were encountered: