From 959859c19a073282c70fcbd987eba5f9d8a83e51 Mon Sep 17 00:00:00 2001 From: StarAurryon Date: Thu, 30 Jul 2020 23:50:37 +0200 Subject: [PATCH] Fixing qtmoc not handling pointer to object in QT signal properly: the callback is returning the value of the pointer instead of the pointer --- internal/binding/templater/function_go.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/binding/templater/function_go.go b/internal/binding/templater/function_go.go index 87ccb1d98..e1afffe6c 100644 --- a/internal/binding/templater/function_go.go +++ b/internal/binding/templater/function_go.go @@ -364,7 +364,11 @@ func goFunctionBody(function *parser.Function) string { if !strings.HasSuffix(function.Name, "Changed") { //TODO: check if property instead fmt.Fprintf(bb, "qt.UnregisterTemp(unsafe.Pointer(uintptr(%v)))\n", parser.CleanName(p.Name, p.Value)) } - fmt.Fprintf(bb, "%[1]vD = (*(*%v)(%[1]vI))\n", parser.CleanName(p.Name, p.Value), p.PureGoType) + if strings.HasPrefix(p.PureGoType, "*") { + fmt.Fprintf(bb, "%[1]vD = (%v)(%[1]vI)\n", parser.CleanName(p.Name, p.Value), p.PureGoType) + } else { + fmt.Fprintf(bb, "%[1]vD = (*(*%v)(%[1]vI))\n", parser.CleanName(p.Name, p.Value), p.PureGoType) + } fmt.Fprint(bb, "}\n") } }