Skip to content

Commit

Permalink
fixes for various potential memory leaks
Browse files Browse the repository at this point in the history
* speedup js binding generation + minor js related fixes
* support for private quickcontrols2 classes with `QT_GEN_QUICK_EXTRAS=true`
* fix for static linux deployment issue
* minor example updates
* fix for minor qtmoc docker related issue
  • Loading branch information
therecipe committed Nov 28, 2019
1 parent 0f56c66 commit 47559b8
Show file tree
Hide file tree
Showing 61 changed files with 1,525 additions and 353 deletions.
15 changes: 12 additions & 3 deletions androidextras/androidextras_android.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ func NewQAndroidActivityResultReceiverFromPointer(ptr unsafe.Pointer) (n *QAndro

func (ptr *QAndroidActivityResultReceiver) DestroyQAndroidActivityResultReceiver() {
if ptr != nil {
C.free(ptr.Pointer())

qt.DisconnectAllSignals(ptr.Pointer(), "")
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -174,8 +175,9 @@ func NewQAndroidBinderFromPointer(ptr unsafe.Pointer) (n *QAndroidBinder) {

func (ptr *QAndroidBinder) DestroyQAndroidBinder() {
if ptr != nil {
C.free(ptr.Pointer())

qt.DisconnectAllSignals(ptr.Pointer(), "")
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -254,6 +256,7 @@ func NewQAndroidIntentFromPointer(ptr unsafe.Pointer) (n *QAndroidIntent) {

func (ptr *QAndroidIntent) DestroyQAndroidIntent() {
if ptr != nil {

C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
Expand Down Expand Up @@ -419,6 +422,7 @@ func (ptr *QAndroidJniEnvironment) JavaVM() unsafe.Pointer {
func (ptr *QAndroidJniEnvironment) DestroyQAndroidJniEnvironment() {
if ptr.Pointer() != nil {
C.QAndroidJniEnvironment_DestroyQAndroidJniEnvironment(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -518,6 +522,7 @@ func (ptr *QAndroidJniExceptionCleaner) Clean() {
func (ptr *QAndroidJniExceptionCleaner) DestroyQAndroidJniExceptionCleaner() {
if ptr.Pointer() != nil {
C.QAndroidJniExceptionCleaner_DestroyQAndroidJniExceptionCleaner(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -3640,6 +3645,7 @@ func (ptr *QAndroidJniObject) DestroyQAndroidJniObject() {
if ptr.Pointer() != nil {
qt.DisconnectAllSignals(ptr.Pointer(), "")
C.QAndroidJniObject_DestroyQAndroidJniObject(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -3685,6 +3691,7 @@ func NewQAndroidParcelFromPointer(ptr unsafe.Pointer) (n *QAndroidParcel) {

func (ptr *QAndroidParcel) DestroyQAndroidParcel() {
if ptr != nil {

C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
Expand Down Expand Up @@ -4216,8 +4223,9 @@ func NewQAndroidServiceConnectionFromPointer(ptr unsafe.Pointer) (n *QAndroidSer

func (ptr *QAndroidServiceConnection) DestroyQAndroidServiceConnection() {
if ptr != nil {
C.free(ptr.Pointer())

qt.DisconnectAllSignals(ptr.Pointer(), "")
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -4362,6 +4370,7 @@ func NewQtAndroidFromPointer(ptr unsafe.Pointer) (n *QtAndroid) {

func (ptr *QtAndroid) DestroyQtAndroid() {
if ptr != nil {

C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
Expand Down
15 changes: 15 additions & 0 deletions bluetooth/bluetooth.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func NewQBluetoothFromPointer(ptr unsafe.Pointer) (n *QBluetooth) {

func (ptr *QBluetooth) DestroyQBluetooth() {
if ptr != nil {

C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
Expand Down Expand Up @@ -201,6 +202,7 @@ func (ptr *QBluetoothAddress) ToUInt64() uint64 {
func (ptr *QBluetoothAddress) DestroyQBluetoothAddress() {
if ptr.Pointer() != nil {
C.QBluetoothAddress_DestroyQBluetoothAddress(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -1434,6 +1436,7 @@ func (ptr *QBluetoothDeviceInfo) SetServiceUuids2(uuids []*QBluetoothUuid) {
func (ptr *QBluetoothDeviceInfo) DestroyQBluetoothDeviceInfo() {
if ptr.Pointer() != nil {
C.QBluetoothDeviceInfo_DestroyQBluetoothDeviceInfo(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -1615,6 +1618,7 @@ func (ptr *QBluetoothHostInfo) SetName(name string) {
func (ptr *QBluetoothHostInfo) DestroyQBluetoothHostInfo() {
if ptr.Pointer() != nil {
C.QBluetoothHostInfo_DestroyQBluetoothHostInfo(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -4130,6 +4134,7 @@ func (ptr *QBluetoothServiceInfo) UnregisterService() bool {
func (ptr *QBluetoothServiceInfo) DestroyQBluetoothServiceInfo() {
if ptr.Pointer() != nil {
C.QBluetoothServiceInfo_DestroyQBluetoothServiceInfo(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -6445,6 +6450,7 @@ func (ptr *QBluetoothTransferRequest) SetAttribute(code QBluetoothTransferReques
func (ptr *QBluetoothTransferRequest) DestroyQBluetoothTransferRequest() {
if ptr.Pointer() != nil {
C.QBluetoothTransferRequest_DestroyQBluetoothTransferRequest(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -6914,6 +6920,7 @@ func (ptr *QBluetoothUuid) ToUInt32(ok *bool) uint {
func (ptr *QBluetoothUuid) DestroyQBluetoothUuid() {
if ptr.Pointer() != nil {
C.QBluetoothUuid_DestroyQBluetoothUuid(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -7094,6 +7101,7 @@ func (ptr *QLowEnergyAdvertisingData) Swap(other QLowEnergyAdvertisingData_ITF)
func (ptr *QLowEnergyAdvertisingData) DestroyQLowEnergyAdvertisingData() {
if ptr.Pointer() != nil {
C.QLowEnergyAdvertisingData_DestroyQLowEnergyAdvertisingData(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -7257,6 +7265,7 @@ func (ptr *QLowEnergyAdvertisingParameters) Swap(other QLowEnergyAdvertisingPara
func (ptr *QLowEnergyAdvertisingParameters) DestroyQLowEnergyAdvertisingParameters() {
if ptr.Pointer() != nil {
C.QLowEnergyAdvertisingParameters_DestroyQLowEnergyAdvertisingParameters(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -7393,6 +7402,7 @@ func (ptr *QLowEnergyCharacteristic) Value() *core.QByteArray {
func (ptr *QLowEnergyCharacteristic) DestroyQLowEnergyCharacteristic() {
if ptr.Pointer() != nil {
C.QLowEnergyCharacteristic_DestroyQLowEnergyCharacteristic(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -7603,6 +7613,7 @@ func (ptr *QLowEnergyCharacteristicData) WriteConstraints() QBluetooth__AttAcces
func (ptr *QLowEnergyCharacteristicData) DestroyQLowEnergyCharacteristicData() {
if ptr.Pointer() != nil {
C.QLowEnergyCharacteristicData_DestroyQLowEnergyCharacteristicData(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -7750,6 +7761,7 @@ func (ptr *QLowEnergyConnectionParameters) Swap(other QLowEnergyConnectionParame
func (ptr *QLowEnergyConnectionParameters) DestroyQLowEnergyConnectionParameters() {
if ptr.Pointer() != nil {
C.QLowEnergyConnectionParameters_DestroyQLowEnergyConnectionParameters(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -8715,6 +8727,7 @@ func (ptr *QLowEnergyDescriptor) Value() *core.QByteArray {
func (ptr *QLowEnergyDescriptor) DestroyQLowEnergyDescriptor() {
if ptr.Pointer() != nil {
C.QLowEnergyDescriptor_DestroyQLowEnergyDescriptor(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -8861,6 +8874,7 @@ func (ptr *QLowEnergyDescriptorData) WriteConstraints() QBluetooth__AttAccessCon
func (ptr *QLowEnergyDescriptorData) DestroyQLowEnergyDescriptorData() {
if ptr.Pointer() != nil {
C.QLowEnergyDescriptorData_DestroyQLowEnergyDescriptorData(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down Expand Up @@ -9858,6 +9872,7 @@ func (ptr *QLowEnergyServiceData) Uuid() *QBluetoothUuid {
func (ptr *QLowEnergyServiceData) DestroyQLowEnergyServiceData() {
if ptr.Pointer() != nil {
C.QLowEnergyServiceData_DestroyQLowEnergyServiceData(ptr.Pointer())
C.free(ptr.Pointer())
ptr.SetPointer(nil)
runtime.SetFinalizer(ptr, nil)
}
Expand Down
Loading

0 comments on commit 47559b8

Please sign in to comment.