bindings: fix segfault in QApplication_new taking arg by reference

This commit is contained in:
mappu 2024-08-06 10:22:29 +12:00
parent fea87aff42
commit 48ab3420ff
3 changed files with 6 additions and 5 deletions

View File

@ -3,8 +3,9 @@
#include <QWidget> #include <QWidget>
#include <QPushButton> #include <QPushButton>
PQApplication QApplication_new(int argc, char** argv) { PQApplication QApplication_new(int* argc, char** argv) {
return new QApplication(argc, argv); // QApplication takes these parameters byref, not by value
return new QApplication(*argc, argv);
} }
PQWidget QWidget_new() { PQWidget QWidget_new() {

View File

@ -30,7 +30,8 @@ type QApplication struct {
} }
func NewQApplication(args []string) *QApplication { func NewQApplication(args []string) *QApplication {
h := C.QApplication_new(CArray(args)) argc, argv := CArray(args)
h := C.QApplication_new(&argc, argv)
return &QApplication{h: h} return &QApplication{h: h}
} }

View File

@ -7,8 +7,7 @@ typedef void* PQWidget;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
PQApplication QApplication_new(int* argc, char** argv);
PQApplication QApplication_new(int argc, char** argv);
PQWidget QWidget_new(); PQWidget QWidget_new();