go-qml / qml

QML support for the Go language
Other
1.96k stars 189 forks source link

cgo fixes via @amlwwalker via @SjB #186

Open jackman0 opened 6 years ago

jackman0 commented 6 years ago

I did a diff between the @niemeyer code and the @amlwwalker code. This branch should only contain the changes required to get QML to work without using GODEBUG=cgocheck=0. I'm not an expert in cgo or QML, but I know that this branch works for me.

His comments in issue #179:

Hi All,

I ran into this error a while back. I can briefly explain what is going on here. go-qml passes (or receives, I can't remember) a pointer to a pointer to C code within the qml libraries. Doing so means that the Go garbarge collector cannot see whether the pointer has been released by the C code. This can lead to memory leaks so in go1.6 this was made a forbidden thing to do (and is only detected at runtime). So hence the error: cgo argument has Go pointer to Go pointer.

github.com/SjB/qml solves this in its latest branch, however SjB doesn't seem to be monitoring the repo, so I have forked it and although my knowledge of the low level api to the qml libraries is unknown to me, I am managing the code to make the examples work and plan to make small changes to make it convenient to use going forward. You can find it at https://github.com/amlwwalker/qml

I'm using it now actively, so I can help people get set up if they are struggling with post 1.6 qml and Go.

A
jackman0 commented 6 years ago

Apparently, this was already done.

jackman0 commented 6 years ago

Nevermind. It appears that none of the other pull requests went through. What is keeping this from hitting master or v1 branches?

amlwwalker commented 6 years ago

@jackmanlabs I recommend using therecipe/qt for go and qt/qml for now on. I have had a lot more luck with that project than this one. I have written up my own findings and project to get you started here. Pretty fast to get up and running https://github.com/amlwwalker/got-qt