therecipe / qt

Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
GNU Lesser General Public License v3.0
10.5k stars 748 forks source link

panic: reflect: New(nil) goroutine 1 [running, locked to thread]: reflect.New(0x0, 0x0, 0x0, 0x0, 0x0) #1238

Open hiteshhedwig opened 3 years ago

hiteshhedwig commented 3 years ago

Hi,

I have been trying to deal with this issue from some time.

INFO[0000] Starting the App                             
INFO[0000] Into ConfigManager the App                   
INFO[0000] Protocol InuseTCPIP                          
looking for qtbox in: /home/username/gocv_work/src/synlabs.io/SYNRADAR/qtbox
final qtbox location: /home/username/gocv_work/src/synlabs.io/SYNRADAR/qtbox
INFO[0008] Clicked                                      
INFO[0008] in signal init                               
panic: reflect: New(nil)

goroutine 1 [running, locked to thread]:
reflect.New(0x0, 0x0, 0x0, 0x0, 0x0)
        reflect/value.go:2351 +0xc1
github.com/therecipe/qt/interop.Z_wrapperFunction(0xc0003bc138, 0x0)
        github.com/therecipe/qt/interop/interop.go:165 +0x1189
github.com/therecipe/qt/interop._syncCallIntoLocal.func2()
        github.com/therecipe/qt/interop/interop_api.go:62 +0x3c
github.com/therecipe/qt/interop.(*PseudoQJSValue).callRemote(0xc0002a8c40, 0xc0003f1e48, 0x1, 0x1, 0x0)
        github.com/therecipe/qt/interop/pseudo_value.go:244 +0x8e7
github.com/therecipe/qt/interop.(*PseudoQJSValue).Call(0xc0002a8c40, 0xc0003f1e48, 0x1, 0x1, 0xc0003f1e68)
        github.com/therecipe/qt/interop/pseudo_value.go:160 +0x1a5
github.com/therecipe/qt/interop.(*PseudoQJSEngine).fromJsToRef.func1(0xc000442580, 0x1, 0x1, 0xc000442580, 0xc000291bc8, 0x96710e)
        github.com/therecipe/qt/interop/interop.go:299 +0x176
reflect.callReflect(0xc000188ea0, 0xc000291cc0, 0xc000291ca8)
        reflect/value.go:549 +0x322
reflect.makeFuncStub(0x3a01000, 0x8f80fd0, 0x3df56c1, 0x9, 0xc0002a8c60, 0xc000291d08, 0x1631e64, 0x8f80fd0, 0x3e71c00, 0xc000291d38, ...)
        reflect/asm_amd64.s:20 +0x42
github.com/therecipe/qt/widgets.callbackQAction_Triggered(0x8f80fd0, 0x3e71c00)
        github.com/therecipe/qt/widgets/widgets.go:8284 +0x73
github.com/therecipe/qt/widgets._cgoexpwrap_5632bddda97f_callbackQAction_Triggered(0x8f80fd0, 0x8f80f00)
        _cgo_gotypes.go:109347 +0x34
github.com/therecipe/qt/widgets._Cfunc_QApplication_QApplication_Exec(0x0)
        _cgo_gotypes.go:9044 +0x49
github.com/therecipe/qt/widgets.QApplication_Exec(...)
        github.com/therecipe/qt/widgets/widgets.go:9694
main.main()
        github.com/therecipe/box/full/full_box.go:25 +0x69
httpRequest error: ["",69514592,"","ConnectDestroyed","___REMOTE_CALLBACK___"] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": EOF

My code : So there is a search button that comes on my UI. whenever i click search button. It throws above issue.

main.go

//function called when search button in  UI window is clicked.
func (c *ConfigManager) Search() {
    log.Info("Clicked")
    dd := NewSearchDeviceDialog(nil) 
    log.Info("Hii")
    dd.InitUI()
    dd.dialog.Exec()

}

struct snippet in searchdevicedialog.go


type SearchDeviceDialog struct {
    core.QObject

    _ func() `constructor:"init"`

    _ func() `signal:"mySignal"`

    devices         []DeviceConfig
    deviceids       []string
    connectedDevice *Device
    dialog          *widgets.QDialog
    table           *widgets.QTableWidget
    items           int
    menu            *widgets.QMenu
    lastselected    int
}

go.mod

module myui

go 1.15

require (
    github.com/sirupsen/logrus v1.8.1
    github.com/therecipe/qt v0.0.0-20200904063919-c0c124a5770d
)

Can you help me figure out?

Thanks