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

cgo fixes via @amlwwalker via @SjB #186

Open
wants to merge 89 commits into
base: master
Choose a base branch
from
Open

cgo fixes via @amlwwalker via @SjB #186

wants to merge 89 commits into from

Conversation

jackman0
Copy link

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

niemeyer and others added 30 commits May 1, 2014 18:10
Tests can use SetupTesting instead of Run.
GoImageProvider had a memory leak where it got a pointer to a QImage,
and never freed it. Qt already has a refcounting system in place so every
QImage is actually a pointer to pixel data, but it relies on the destructor
for every QImage instance to be called.
Fix ImageProvider data leak in C++ logic.

Fix by Carlos Castillo.
Update requirements for OS X.
Update README for v1 branch.
Changed examples URL to match current branch.
Thanks to David Crawshaw for the suggestion.
qml.v0 seems to be deprecated and doesn't work with the latest Go 1.3.1. Updating the README to reflect this.
Thanks to Ignazio Di Napoli for reporting the issue.
Before 5.3 logic goes mainstream it cannot rely on qt to
resolve the missing symbols.
lomoalbert and others added 24 commits October 8, 2014 10:19
apt-get install ubuntu-app-launch;"upstart-app-launch" >> "ubuntu-app-launch"
Documentation updates.
change "upstart-app-launch" to "ubuntu-app-launch"
apt-get install ubuntu-app-launch;"upstart-app-launch" >> "ubuntu-app-launch"
Documentation updates.
Ported some of the qtquickcontrols examples.
Make sure context.file is not null before calling strlen.
Go 1.6 cannot have Go pointer stored into the cgo space. So instead we
need to store all Go values in a map and pass a key to the cgo
space. When needed the key can be used to retrieve the go value from the
map.
Using the C.GoRef datatype instead of uintptr in
the go code make it more clear what the variable
contains.
added methods to the type so that we can get the GoRef and register the
fold in the lookup table, then a function to destroy the reference when
we are done with the valueFold.
When unpacking a DataValue of a DTGoAddr type, we forgot to dereference the datap pointer
that contained the GoRef.

Thanks to immesys on github, for pointing out the bug.
@neclepsio on github.com found that when connecting a callback function
on a MouseArea event the application would panic. This was cause by the
extra derefrence on the interface of the function.
@jackman0
Copy link
Author

Apparently, this was already done.

@jackman0 jackman0 closed this Mar 29, 2018
@jackman0
Copy link
Author

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

@jackman0 jackman0 reopened this Mar 29, 2018
@amlwwalker
Copy link

amlwwalker commented May 17, 2018

@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

@jamalsa jamalsa mentioned this pull request Nov 1, 2018
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

Successfully merging this pull request may close these issues.