diff --git a/qt/gen_qabstractanimation.go b/qt/gen_qabstractanimation.go
index e6d05e01..6d0e30e7 100644
--- a/qt/gen_qabstractanimation.go
+++ b/qt/gen_qabstractanimation.go
@@ -28,6 +28,9 @@ func (this *QAbstractAnimation) cPointer() *C.QAbstractAnimation {
 }
 
 func newQAbstractAnimation(h *C.QAbstractAnimation) *QAbstractAnimation {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractAnimation{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -260,6 +263,9 @@ func (this *QAnimationDriver) cPointer() *C.QAnimationDriver {
 }
 
 func newQAnimationDriver(h *C.QAnimationDriver) *QAnimationDriver {
+	if h == nil {
+		return nil
+	}
 	return &QAnimationDriver{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractbutton.go b/qt/gen_qabstractbutton.go
index 609c0d57..f94ef483 100644
--- a/qt/gen_qabstractbutton.go
+++ b/qt/gen_qabstractbutton.go
@@ -29,6 +29,9 @@ func (this *QAbstractButton) cPointer() *C.QAbstractButton {
 }
 
 func newQAbstractButton(h *C.QAbstractButton) *QAbstractButton {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractButton{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstracteventdispatcher.go b/qt/gen_qabstracteventdispatcher.go
index 43ee34d7..5404ce85 100644
--- a/qt/gen_qabstracteventdispatcher.go
+++ b/qt/gen_qabstracteventdispatcher.go
@@ -28,6 +28,9 @@ func (this *QAbstractEventDispatcher) cPointer() *C.QAbstractEventDispatcher {
 }
 
 func newQAbstractEventDispatcher(h *C.QAbstractEventDispatcher) *QAbstractEventDispatcher {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractEventDispatcher{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -247,6 +250,9 @@ func (this *QAbstractEventDispatcher__TimerInfo) cPointer() *C.QAbstractEventDis
 }
 
 func newQAbstractEventDispatcher__TimerInfo(h *C.QAbstractEventDispatcher__TimerInfo) *QAbstractEventDispatcher__TimerInfo {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractEventDispatcher__TimerInfo{h: h}
 }
 
diff --git a/qt/gen_qabstractitemdelegate.go b/qt/gen_qabstractitemdelegate.go
index 579bb045..1a04ef20 100644
--- a/qt/gen_qabstractitemdelegate.go
+++ b/qt/gen_qabstractitemdelegate.go
@@ -29,6 +29,9 @@ func (this *QAbstractItemDelegate) cPointer() *C.QAbstractItemDelegate {
 }
 
 func newQAbstractItemDelegate(h *C.QAbstractItemDelegate) *QAbstractItemDelegate {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractItemDelegate{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractitemmodel.go b/qt/gen_qabstractitemmodel.go
index cf312a56..6737644f 100644
--- a/qt/gen_qabstractitemmodel.go
+++ b/qt/gen_qabstractitemmodel.go
@@ -28,6 +28,9 @@ func (this *QModelIndex) cPointer() *C.QModelIndex {
 }
 
 func newQModelIndex(h *C.QModelIndex) *QModelIndex {
+	if h == nil {
+		return nil
+	}
 	return &QModelIndex{h: h}
 }
 
@@ -185,6 +188,9 @@ func (this *QPersistentModelIndex) cPointer() *C.QPersistentModelIndex {
 }
 
 func newQPersistentModelIndex(h *C.QPersistentModelIndex) *QPersistentModelIndex {
+	if h == nil {
+		return nil
+	}
 	return &QPersistentModelIndex{h: h}
 }
 
@@ -349,6 +355,9 @@ func (this *QAbstractItemModel) cPointer() *C.QAbstractItemModel {
 }
 
 func newQAbstractItemModel(h *C.QAbstractItemModel) *QAbstractItemModel {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractItemModel{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -946,6 +955,9 @@ func (this *QAbstractTableModel) cPointer() *C.QAbstractTableModel {
 }
 
 func newQAbstractTableModel(h *C.QAbstractTableModel) *QAbstractTableModel {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractTableModel{h: h, QAbstractItemModel: newQAbstractItemModel_U(unsafe.Pointer(h))}
 }
 
@@ -1092,6 +1104,9 @@ func (this *QAbstractListModel) cPointer() *C.QAbstractListModel {
 }
 
 func newQAbstractListModel(h *C.QAbstractListModel) *QAbstractListModel {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractListModel{h: h, QAbstractItemModel: newQAbstractItemModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractitemview.go b/qt/gen_qabstractitemview.go
index a23479a3..270b1d4c 100644
--- a/qt/gen_qabstractitemview.go
+++ b/qt/gen_qabstractitemview.go
@@ -29,6 +29,9 @@ func (this *QAbstractItemView) cPointer() *C.QAbstractItemView {
 }
 
 func newQAbstractItemView(h *C.QAbstractItemView) *QAbstractItemView {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractItemView{h: h, QAbstractScrollArea: newQAbstractScrollArea_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractnativeeventfilter.go b/qt/gen_qabstractnativeeventfilter.go
index 4ae7c774..c93044e5 100644
--- a/qt/gen_qabstractnativeeventfilter.go
+++ b/qt/gen_qabstractnativeeventfilter.go
@@ -26,6 +26,9 @@ func (this *QAbstractNativeEventFilter) cPointer() *C.QAbstractNativeEventFilter
 }
 
 func newQAbstractNativeEventFilter(h *C.QAbstractNativeEventFilter) *QAbstractNativeEventFilter {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractNativeEventFilter{h: h}
 }
 
diff --git a/qt/gen_qabstractproxymodel.go b/qt/gen_qabstractproxymodel.go
index f208110f..95377733 100644
--- a/qt/gen_qabstractproxymodel.go
+++ b/qt/gen_qabstractproxymodel.go
@@ -28,6 +28,9 @@ func (this *QAbstractProxyModel) cPointer() *C.QAbstractProxyModel {
 }
 
 func newQAbstractProxyModel(h *C.QAbstractProxyModel) *QAbstractProxyModel {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractProxyModel{h: h, QAbstractItemModel: newQAbstractItemModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractscrollarea.go b/qt/gen_qabstractscrollarea.go
index 92e32f73..eebbce0e 100644
--- a/qt/gen_qabstractscrollarea.go
+++ b/qt/gen_qabstractscrollarea.go
@@ -28,6 +28,9 @@ func (this *QAbstractScrollArea) cPointer() *C.QAbstractScrollArea {
 }
 
 func newQAbstractScrollArea(h *C.QAbstractScrollArea) *QAbstractScrollArea {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractScrollArea{h: h, QFrame: newQFrame_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractslider.go b/qt/gen_qabstractslider.go
index f9d1fb22..de07f0b9 100644
--- a/qt/gen_qabstractslider.go
+++ b/qt/gen_qabstractslider.go
@@ -28,6 +28,9 @@ func (this *QAbstractSlider) cPointer() *C.QAbstractSlider {
 }
 
 func newQAbstractSlider(h *C.QAbstractSlider) *QAbstractSlider {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractSlider{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractspinbox.go b/qt/gen_qabstractspinbox.go
index 040061fb..e81133d2 100644
--- a/qt/gen_qabstractspinbox.go
+++ b/qt/gen_qabstractspinbox.go
@@ -29,6 +29,9 @@ func (this *QAbstractSpinBox) cPointer() *C.QAbstractSpinBox {
 }
 
 func newQAbstractSpinBox(h *C.QAbstractSpinBox) *QAbstractSpinBox {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractSpinBox{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstractstate.go b/qt/gen_qabstractstate.go
index f88ae41a..9eb507d0 100644
--- a/qt/gen_qabstractstate.go
+++ b/qt/gen_qabstractstate.go
@@ -28,6 +28,9 @@ func (this *QAbstractState) cPointer() *C.QAbstractState {
 }
 
 func newQAbstractState(h *C.QAbstractState) *QAbstractState {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractState{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qabstracttextdocumentlayout.go b/qt/gen_qabstracttextdocumentlayout.go
index ce2f8338..80a10486 100644
--- a/qt/gen_qabstracttextdocumentlayout.go
+++ b/qt/gen_qabstracttextdocumentlayout.go
@@ -29,6 +29,9 @@ func (this *QAbstractTextDocumentLayout) cPointer() *C.QAbstractTextDocumentLayo
 }
 
 func newQAbstractTextDocumentLayout(h *C.QAbstractTextDocumentLayout) *QAbstractTextDocumentLayout {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractTextDocumentLayout{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -296,6 +299,9 @@ func (this *QTextObjectInterface) cPointer() *C.QTextObjectInterface {
 }
 
 func newQTextObjectInterface(h *C.QTextObjectInterface) *QTextObjectInterface {
+	if h == nil {
+		return nil
+	}
 	return &QTextObjectInterface{h: h}
 }
 
@@ -334,6 +340,9 @@ func (this *QAbstractTextDocumentLayout__Selection) cPointer() *C.QAbstractTextD
 }
 
 func newQAbstractTextDocumentLayout__Selection(h *C.QAbstractTextDocumentLayout__Selection) *QAbstractTextDocumentLayout__Selection {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractTextDocumentLayout__Selection{h: h}
 }
 
@@ -363,6 +372,9 @@ func (this *QAbstractTextDocumentLayout__PaintContext) cPointer() *C.QAbstractTe
 }
 
 func newQAbstractTextDocumentLayout__PaintContext(h *C.QAbstractTextDocumentLayout__PaintContext) *QAbstractTextDocumentLayout__PaintContext {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractTextDocumentLayout__PaintContext{h: h}
 }
 
diff --git a/qt/gen_qabstracttransition.go b/qt/gen_qabstracttransition.go
index 5c160096..561fd455 100644
--- a/qt/gen_qabstracttransition.go
+++ b/qt/gen_qabstracttransition.go
@@ -27,6 +27,9 @@ func (this *QAbstractTransition) cPointer() *C.QAbstractTransition {
 }
 
 func newQAbstractTransition(h *C.QAbstractTransition) *QAbstractTransition {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractTransition{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qaccessible.go b/qt/gen_qaccessible.go
index 8acde5b6..9675e6fb 100644
--- a/qt/gen_qaccessible.go
+++ b/qt/gen_qaccessible.go
@@ -27,6 +27,9 @@ func (this *QAccessible) cPointer() *C.QAccessible {
 }
 
 func newQAccessible(h *C.QAccessible) *QAccessible {
+	if h == nil {
+		return nil
+	}
 	return &QAccessible{h: h}
 }
 
@@ -103,6 +106,9 @@ func (this *QAccessibleInterface) cPointer() *C.QAccessibleInterface {
 }
 
 func newQAccessibleInterface(h *C.QAccessibleInterface) *QAccessibleInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleInterface{h: h}
 }
 
@@ -266,6 +272,9 @@ func (this *QAccessibleTextInterface) cPointer() *C.QAccessibleTextInterface {
 }
 
 func newQAccessibleTextInterface(h *C.QAccessibleTextInterface) *QAccessibleTextInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTextInterface{h: h}
 }
 
@@ -393,6 +402,9 @@ func (this *QAccessibleEditableTextInterface) cPointer() *C.QAccessibleEditableT
 }
 
 func newQAccessibleEditableTextInterface(h *C.QAccessibleEditableTextInterface) *QAccessibleEditableTextInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleEditableTextInterface{h: h}
 }
 
@@ -436,6 +448,9 @@ func (this *QAccessibleValueInterface) cPointer() *C.QAccessibleValueInterface {
 }
 
 func newQAccessibleValueInterface(h *C.QAccessibleValueInterface) *QAccessibleValueInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleValueInterface{h: h}
 }
 
@@ -511,6 +526,9 @@ func (this *QAccessibleTableCellInterface) cPointer() *C.QAccessibleTableCellInt
 }
 
 func newQAccessibleTableCellInterface(h *C.QAccessibleTableCellInterface) *QAccessibleTableCellInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTableCellInterface{h: h}
 }
 
@@ -594,6 +612,9 @@ func (this *QAccessibleTableInterface) cPointer() *C.QAccessibleTableInterface {
 }
 
 func newQAccessibleTableInterface(h *C.QAccessibleTableInterface) *QAccessibleTableInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTableInterface{h: h}
 }
 
@@ -748,6 +769,9 @@ func (this *QAccessibleActionInterface) cPointer() *C.QAccessibleActionInterface
 }
 
 func newQAccessibleActionInterface(h *C.QAccessibleActionInterface) *QAccessibleActionInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleActionInterface{h: h}
 }
 
@@ -1017,6 +1041,9 @@ func (this *QAccessibleImageInterface) cPointer() *C.QAccessibleImageInterface {
 }
 
 func newQAccessibleImageInterface(h *C.QAccessibleImageInterface) *QAccessibleImageInterface {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleImageInterface{h: h}
 }
 
@@ -1075,6 +1102,9 @@ func (this *QAccessibleEvent) cPointer() *C.QAccessibleEvent {
 }
 
 func newQAccessibleEvent(h *C.QAccessibleEvent) *QAccessibleEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleEvent{h: h}
 }
 
@@ -1140,6 +1170,9 @@ func (this *QAccessibleStateChangeEvent) cPointer() *C.QAccessibleStateChangeEve
 }
 
 func newQAccessibleStateChangeEvent(h *C.QAccessibleStateChangeEvent) *QAccessibleStateChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleStateChangeEvent{h: h, QAccessibleEvent: newQAccessibleEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1187,6 +1220,9 @@ func (this *QAccessibleTextCursorEvent) cPointer() *C.QAccessibleTextCursorEvent
 }
 
 func newQAccessibleTextCursorEvent(h *C.QAccessibleTextCursorEvent) *QAccessibleTextCursorEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTextCursorEvent{h: h, QAccessibleEvent: newQAccessibleEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1232,6 +1268,9 @@ func (this *QAccessibleTextSelectionEvent) cPointer() *C.QAccessibleTextSelectio
 }
 
 func newQAccessibleTextSelectionEvent(h *C.QAccessibleTextSelectionEvent) *QAccessibleTextSelectionEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTextSelectionEvent{h: h, QAccessibleTextCursorEvent: newQAccessibleTextCursorEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1282,6 +1321,9 @@ func (this *QAccessibleTextInsertEvent) cPointer() *C.QAccessibleTextInsertEvent
 }
 
 func newQAccessibleTextInsertEvent(h *C.QAccessibleTextInsertEvent) *QAccessibleTextInsertEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTextInsertEvent{h: h, QAccessibleTextCursorEvent: newQAccessibleTextCursorEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1336,6 +1378,9 @@ func (this *QAccessibleTextRemoveEvent) cPointer() *C.QAccessibleTextRemoveEvent
 }
 
 func newQAccessibleTextRemoveEvent(h *C.QAccessibleTextRemoveEvent) *QAccessibleTextRemoveEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTextRemoveEvent{h: h, QAccessibleTextCursorEvent: newQAccessibleTextCursorEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1390,6 +1435,9 @@ func (this *QAccessibleTextUpdateEvent) cPointer() *C.QAccessibleTextUpdateEvent
 }
 
 func newQAccessibleTextUpdateEvent(h *C.QAccessibleTextUpdateEvent) *QAccessibleTextUpdateEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTextUpdateEvent{h: h, QAccessibleTextCursorEvent: newQAccessibleTextCursorEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1457,6 +1505,9 @@ func (this *QAccessibleValueChangeEvent) cPointer() *C.QAccessibleValueChangeEve
 }
 
 func newQAccessibleValueChangeEvent(h *C.QAccessibleValueChangeEvent) *QAccessibleValueChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleValueChangeEvent{h: h, QAccessibleEvent: newQAccessibleEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1508,6 +1559,9 @@ func (this *QAccessibleTableModelChangeEvent) cPointer() *C.QAccessibleTableMode
 }
 
 func newQAccessibleTableModelChangeEvent(h *C.QAccessibleTableModelChangeEvent) *QAccessibleTableModelChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleTableModelChangeEvent{h: h, QAccessibleEvent: newQAccessibleEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1588,6 +1642,9 @@ func (this *QAccessible__State) cPointer() *C.QAccessible__State {
 }
 
 func newQAccessible__State(h *C.QAccessible__State) *QAccessible__State {
+	if h == nil {
+		return nil
+	}
 	return &QAccessible__State{h: h}
 }
 
@@ -1623,6 +1680,9 @@ func (this *QAccessible__ActivationObserver) cPointer() *C.QAccessible__Activati
 }
 
 func newQAccessible__ActivationObserver(h *C.QAccessible__ActivationObserver) *QAccessible__ActivationObserver {
+	if h == nil {
+		return nil
+	}
 	return &QAccessible__ActivationObserver{h: h}
 }
 
diff --git a/qt/gen_qaccessiblebridge.go b/qt/gen_qaccessiblebridge.go
index df24e60c..652e8160 100644
--- a/qt/gen_qaccessiblebridge.go
+++ b/qt/gen_qaccessiblebridge.go
@@ -26,6 +26,9 @@ func (this *QAccessibleBridge) cPointer() *C.QAccessibleBridge {
 }
 
 func newQAccessibleBridge(h *C.QAccessibleBridge) *QAccessibleBridge {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleBridge{h: h}
 }
 
@@ -62,6 +65,9 @@ func (this *QAccessibleBridgePlugin) cPointer() *C.QAccessibleBridgePlugin {
 }
 
 func newQAccessibleBridgePlugin(h *C.QAccessibleBridgePlugin) *QAccessibleBridgePlugin {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleBridgePlugin{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qaccessibleobject.go b/qt/gen_qaccessibleobject.go
index 8b95344e..3232b137 100644
--- a/qt/gen_qaccessibleobject.go
+++ b/qt/gen_qaccessibleobject.go
@@ -28,6 +28,9 @@ func (this *QAccessibleObject) cPointer() *C.QAccessibleObject {
 }
 
 func newQAccessibleObject(h *C.QAccessibleObject) *QAccessibleObject {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleObject{h: h, QAccessibleInterface: newQAccessibleInterface_U(unsafe.Pointer(h))}
 }
 
@@ -80,6 +83,9 @@ func (this *QAccessibleApplication) cPointer() *C.QAccessibleApplication {
 }
 
 func newQAccessibleApplication(h *C.QAccessibleApplication) *QAccessibleApplication {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleApplication{h: h, QAccessibleObject: newQAccessibleObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qaccessibleplugin.go b/qt/gen_qaccessibleplugin.go
index 3711f761..14a918e3 100644
--- a/qt/gen_qaccessibleplugin.go
+++ b/qt/gen_qaccessibleplugin.go
@@ -27,6 +27,9 @@ func (this *QAccessiblePlugin) cPointer() *C.QAccessiblePlugin {
 }
 
 func newQAccessiblePlugin(h *C.QAccessiblePlugin) *QAccessiblePlugin {
+	if h == nil {
+		return nil
+	}
 	return &QAccessiblePlugin{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qaccessiblewidget.go b/qt/gen_qaccessiblewidget.go
index a2b3dfd5..e00bb61d 100644
--- a/qt/gen_qaccessiblewidget.go
+++ b/qt/gen_qaccessiblewidget.go
@@ -29,6 +29,9 @@ func (this *QAccessibleWidget) cPointer() *C.QAccessibleWidget {
 }
 
 func newQAccessibleWidget(h *C.QAccessibleWidget) *QAccessibleWidget {
+	if h == nil {
+		return nil
+	}
 	return &QAccessibleWidget{h: h, QAccessibleObject: newQAccessibleObject_U(unsafe.Pointer(h)), QAccessibleActionInterface: newQAccessibleActionInterface_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qaction.go b/qt/gen_qaction.go
index 0bd1aa0f..e2bfa3c9 100644
--- a/qt/gen_qaction.go
+++ b/qt/gen_qaction.go
@@ -29,6 +29,9 @@ func (this *QAction) cPointer() *C.QAction {
 }
 
 func newQAction(h *C.QAction) *QAction {
+	if h == nil {
+		return nil
+	}
 	return &QAction{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qactiongroup.go b/qt/gen_qactiongroup.go
index 930470e2..eff76828 100644
--- a/qt/gen_qactiongroup.go
+++ b/qt/gen_qactiongroup.go
@@ -28,6 +28,9 @@ func (this *QActionGroup) cPointer() *C.QActionGroup {
 }
 
 func newQActionGroup(h *C.QActionGroup) *QActionGroup {
+	if h == nil {
+		return nil
+	}
 	return &QActionGroup{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qanimationgroup.go b/qt/gen_qanimationgroup.go
index 4f997463..d799b380 100644
--- a/qt/gen_qanimationgroup.go
+++ b/qt/gen_qanimationgroup.go
@@ -27,6 +27,9 @@ func (this *QAnimationGroup) cPointer() *C.QAnimationGroup {
 }
 
 func newQAnimationGroup(h *C.QAnimationGroup) *QAnimationGroup {
+	if h == nil {
+		return nil
+	}
 	return &QAnimationGroup{h: h, QAbstractAnimation: newQAbstractAnimation_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qapplication.go b/qt/gen_qapplication.go
index d899583b..2acc1c13 100644
--- a/qt/gen_qapplication.go
+++ b/qt/gen_qapplication.go
@@ -29,6 +29,9 @@ func (this *QApplication) cPointer() *C.QApplication {
 }
 
 func newQApplication(h *C.QApplication) *QApplication {
+	if h == nil {
+		return nil
+	}
 	return &QApplication{h: h, QGuiApplication: newQGuiApplication_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qarraydata.go b/qt/gen_qarraydata.go
index 14475ec7..825b0a39 100644
--- a/qt/gen_qarraydata.go
+++ b/qt/gen_qarraydata.go
@@ -26,6 +26,9 @@ func (this *QArrayData) cPointer() *C.QArrayData {
 }
 
 func newQArrayData(h *C.QArrayData) *QArrayData {
+	if h == nil {
+		return nil
+	}
 	return &QArrayData{h: h}
 }
 
@@ -98,6 +101,9 @@ func (this *QtPrivate__QContainerImplHelper) cPointer() *C.QtPrivate__QContainer
 }
 
 func newQtPrivate__QContainerImplHelper(h *C.QtPrivate__QContainerImplHelper) *QtPrivate__QContainerImplHelper {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__QContainerImplHelper{h: h}
 }
 
diff --git a/qt/gen_qbackingstore.go b/qt/gen_qbackingstore.go
index ee6d4e45..2c96cfb2 100644
--- a/qt/gen_qbackingstore.go
+++ b/qt/gen_qbackingstore.go
@@ -27,6 +27,9 @@ func (this *QBackingStore) cPointer() *C.QBackingStore {
 }
 
 func newQBackingStore(h *C.QBackingStore) *QBackingStore {
+	if h == nil {
+		return nil
+	}
 	return &QBackingStore{h: h}
 }
 
diff --git a/qt/gen_qbasictimer.go b/qt/gen_qbasictimer.go
index aa89af36..f6f23aec 100644
--- a/qt/gen_qbasictimer.go
+++ b/qt/gen_qbasictimer.go
@@ -26,6 +26,9 @@ func (this *QBasicTimer) cPointer() *C.QBasicTimer {
 }
 
 func newQBasicTimer(h *C.QBasicTimer) *QBasicTimer {
+	if h == nil {
+		return nil
+	}
 	return &QBasicTimer{h: h}
 }
 
diff --git a/qt/gen_qbitarray.go b/qt/gen_qbitarray.go
index 8bc4bd7f..9beb6b27 100644
--- a/qt/gen_qbitarray.go
+++ b/qt/gen_qbitarray.go
@@ -27,6 +27,9 @@ func (this *QBitArray) cPointer() *C.QBitArray {
 }
 
 func newQBitArray(h *C.QBitArray) *QBitArray {
+	if h == nil {
+		return nil
+	}
 	return &QBitArray{h: h}
 }
 
@@ -252,6 +255,9 @@ func (this *QBitRef) cPointer() *C.QBitRef {
 }
 
 func newQBitRef(h *C.QBitRef) *QBitRef {
+	if h == nil {
+		return nil
+	}
 	return &QBitRef{h: h}
 }
 
diff --git a/qt/gen_qbitmap.go b/qt/gen_qbitmap.go
index 4c059a1f..617c3144 100644
--- a/qt/gen_qbitmap.go
+++ b/qt/gen_qbitmap.go
@@ -28,6 +28,9 @@ func (this *QBitmap) cPointer() *C.QBitmap {
 }
 
 func newQBitmap(h *C.QBitmap) *QBitmap {
+	if h == nil {
+		return nil
+	}
 	return &QBitmap{h: h, QPixmap: newQPixmap_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qboxlayout.go b/qt/gen_qboxlayout.go
index b102fc53..ff813803 100644
--- a/qt/gen_qboxlayout.go
+++ b/qt/gen_qboxlayout.go
@@ -28,6 +28,9 @@ func (this *QBoxLayout) cPointer() *C.QBoxLayout {
 }
 
 func newQBoxLayout(h *C.QBoxLayout) *QBoxLayout {
+	if h == nil {
+		return nil
+	}
 	return &QBoxLayout{h: h, QLayout: newQLayout_U(unsafe.Pointer(h))}
 }
 
@@ -340,6 +343,9 @@ func (this *QHBoxLayout) cPointer() *C.QHBoxLayout {
 }
 
 func newQHBoxLayout(h *C.QHBoxLayout) *QHBoxLayout {
+	if h == nil {
+		return nil
+	}
 	return &QHBoxLayout{h: h, QBoxLayout: newQBoxLayout_U(unsafe.Pointer(h))}
 }
 
@@ -455,6 +461,9 @@ func (this *QVBoxLayout) cPointer() *C.QVBoxLayout {
 }
 
 func newQVBoxLayout(h *C.QVBoxLayout) *QVBoxLayout {
+	if h == nil {
+		return nil
+	}
 	return &QVBoxLayout{h: h, QBoxLayout: newQBoxLayout_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qbrush.go b/qt/gen_qbrush.go
index d9bf9fad..92879fc4 100644
--- a/qt/gen_qbrush.go
+++ b/qt/gen_qbrush.go
@@ -27,6 +27,9 @@ func (this *QBrush) cPointer() *C.QBrush {
 }
 
 func newQBrush(h *C.QBrush) *QBrush {
+	if h == nil {
+		return nil
+	}
 	return &QBrush{h: h}
 }
 
@@ -231,6 +234,9 @@ func (this *QBrushData) cPointer() *C.QBrushData {
 }
 
 func newQBrushData(h *C.QBrushData) *QBrushData {
+	if h == nil {
+		return nil
+	}
 	return &QBrushData{h: h}
 }
 
@@ -264,6 +270,9 @@ func (this *QGradient) cPointer() *C.QGradient {
 }
 
 func newQGradient(h *C.QGradient) *QGradient {
+	if h == nil {
+		return nil
+	}
 	return &QGradient{h: h}
 }
 
@@ -352,6 +361,9 @@ func (this *QLinearGradient) cPointer() *C.QLinearGradient {
 }
 
 func newQLinearGradient(h *C.QLinearGradient) *QLinearGradient {
+	if h == nil {
+		return nil
+	}
 	return &QLinearGradient{h: h, QGradient: newQGradient_U(unsafe.Pointer(h))}
 }
 
@@ -438,6 +450,9 @@ func (this *QRadialGradient) cPointer() *C.QRadialGradient {
 }
 
 func newQRadialGradient(h *C.QRadialGradient) *QRadialGradient {
+	if h == nil {
+		return nil
+	}
 	return &QRadialGradient{h: h, QGradient: newQGradient_U(unsafe.Pointer(h))}
 }
 
@@ -575,6 +590,9 @@ func (this *QConicalGradient) cPointer() *C.QConicalGradient {
 }
 
 func newQConicalGradient(h *C.QConicalGradient) *QConicalGradient {
+	if h == nil {
+		return nil
+	}
 	return &QConicalGradient{h: h, QGradient: newQGradient_U(unsafe.Pointer(h))}
 }
 
@@ -650,6 +668,9 @@ func (this *QGradient__QGradientData) cPointer() *C.QGradient__QGradientData {
 }
 
 func newQGradient__QGradientData(h *C.QGradient__QGradientData) *QGradient__QGradientData {
+	if h == nil {
+		return nil
+	}
 	return &QGradient__QGradientData{h: h}
 }
 
diff --git a/qt/gen_qbuffer.go b/qt/gen_qbuffer.go
index d0c444bc..bace377e 100644
--- a/qt/gen_qbuffer.go
+++ b/qt/gen_qbuffer.go
@@ -27,6 +27,9 @@ func (this *QBuffer) cPointer() *C.QBuffer {
 }
 
 func newQBuffer(h *C.QBuffer) *QBuffer {
+	if h == nil {
+		return nil
+	}
 	return &QBuffer{h: h, QIODevice: newQIODevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qbuttongroup.go b/qt/gen_qbuttongroup.go
index a6bdd237..831c7dc1 100644
--- a/qt/gen_qbuttongroup.go
+++ b/qt/gen_qbuttongroup.go
@@ -28,6 +28,9 @@ func (this *QButtonGroup) cPointer() *C.QButtonGroup {
 }
 
 func newQButtonGroup(h *C.QButtonGroup) *QButtonGroup {
+	if h == nil {
+		return nil
+	}
 	return &QButtonGroup{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qbytearray.go b/qt/gen_qbytearray.go
index 75f089a9..9cdeb4a0 100644
--- a/qt/gen_qbytearray.go
+++ b/qt/gen_qbytearray.go
@@ -27,6 +27,9 @@ func (this *QByteArrayDataPtr) cPointer() *C.QByteArrayDataPtr {
 }
 
 func newQByteArrayDataPtr(h *C.QByteArrayDataPtr) *QByteArrayDataPtr {
+	if h == nil {
+		return nil
+	}
 	return &QByteArrayDataPtr{h: h}
 }
 
@@ -62,6 +65,9 @@ func (this *QByteArray) cPointer() *C.QByteArray {
 }
 
 func newQByteArray(h *C.QByteArray) *QByteArray {
+	if h == nil {
+		return nil
+	}
 	return &QByteArray{h: h}
 }
 
@@ -1570,6 +1576,9 @@ func (this *QByteRef) cPointer() *C.QByteRef {
 }
 
 func newQByteRef(h *C.QByteRef) *QByteRef {
+	if h == nil {
+		return nil
+	}
 	return &QByteRef{h: h}
 }
 
@@ -1637,6 +1646,9 @@ func (this *QByteArray__FromBase64Result) cPointer() *C.QByteArray__FromBase64Re
 }
 
 func newQByteArray__FromBase64Result(h *C.QByteArray__FromBase64Result) *QByteArray__FromBase64Result {
+	if h == nil {
+		return nil
+	}
 	return &QByteArray__FromBase64Result{h: h}
 }
 
diff --git a/qt/gen_qbytearraymatcher.go b/qt/gen_qbytearraymatcher.go
index 8bab13e8..829f464c 100644
--- a/qt/gen_qbytearraymatcher.go
+++ b/qt/gen_qbytearraymatcher.go
@@ -27,6 +27,9 @@ func (this *QByteArrayMatcher) cPointer() *C.QByteArrayMatcher {
 }
 
 func newQByteArrayMatcher(h *C.QByteArrayMatcher) *QByteArrayMatcher {
+	if h == nil {
+		return nil
+	}
 	return &QByteArrayMatcher{h: h}
 }
 
@@ -119,6 +122,9 @@ func (this *QStaticByteArrayMatcherBase) cPointer() *C.QStaticByteArrayMatcherBa
 }
 
 func newQStaticByteArrayMatcherBase(h *C.QStaticByteArrayMatcherBase) *QStaticByteArrayMatcherBase {
+	if h == nil {
+		return nil
+	}
 	return &QStaticByteArrayMatcherBase{h: h}
 }
 
diff --git a/qt/gen_qcalendar.go b/qt/gen_qcalendar.go
index a832332d..1b61b24c 100644
--- a/qt/gen_qcalendar.go
+++ b/qt/gen_qcalendar.go
@@ -27,6 +27,9 @@ func (this *QCalendar) cPointer() *C.QCalendar {
 }
 
 func newQCalendar(h *C.QCalendar) *QCalendar {
+	if h == nil {
+		return nil
+	}
 	return &QCalendar{h: h}
 }
 
@@ -294,6 +297,9 @@ func (this *QCalendar__YearMonthDay) cPointer() *C.QCalendar__YearMonthDay {
 }
 
 func newQCalendar__YearMonthDay(h *C.QCalendar__YearMonthDay) *QCalendar__YearMonthDay {
+	if h == nil {
+		return nil
+	}
 	return &QCalendar__YearMonthDay{h: h}
 }
 
diff --git a/qt/gen_qcalendarwidget.go b/qt/gen_qcalendarwidget.go
index 58b01855..55901152 100644
--- a/qt/gen_qcalendarwidget.go
+++ b/qt/gen_qcalendarwidget.go
@@ -29,6 +29,9 @@ func (this *QCalendarWidget) cPointer() *C.QCalendarWidget {
 }
 
 func newQCalendarWidget(h *C.QCalendarWidget) *QCalendarWidget {
+	if h == nil {
+		return nil
+	}
 	return &QCalendarWidget{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcborarray.go b/qt/gen_qcborarray.go
index cad3d941..1415e235 100644
--- a/qt/gen_qcborarray.go
+++ b/qt/gen_qcborarray.go
@@ -27,6 +27,9 @@ func (this *QCborArray) cPointer() *C.QCborArray {
 }
 
 func newQCborArray(h *C.QCborArray) *QCborArray {
+	if h == nil {
+		return nil
+	}
 	return &QCborArray{h: h}
 }
 
@@ -494,6 +497,9 @@ func (this *QCborArray__Iterator) cPointer() *C.QCborArray__Iterator {
 }
 
 func newQCborArray__Iterator(h *C.QCborArray__Iterator) *QCborArray__Iterator {
+	if h == nil {
+		return nil
+	}
 	return &QCborArray__Iterator{h: h}
 }
 
@@ -665,6 +671,9 @@ func (this *QCborArray__ConstIterator) cPointer() *C.QCborArray__ConstIterator {
 }
 
 func newQCborArray__ConstIterator(h *C.QCborArray__ConstIterator) *QCborArray__ConstIterator {
+	if h == nil {
+		return nil
+	}
 	return &QCborArray__ConstIterator{h: h}
 }
 
diff --git a/qt/gen_qcborcommon.go b/qt/gen_qcborcommon.go
index 9ddc0b33..0f6980b7 100644
--- a/qt/gen_qcborcommon.go
+++ b/qt/gen_qcborcommon.go
@@ -26,6 +26,9 @@ func (this *QCborError) cPointer() *C.QCborError {
 }
 
 func newQCborError(h *C.QCborError) *QCborError {
+	if h == nil {
+		return nil
+	}
 	return &QCborError{h: h}
 }
 
diff --git a/qt/gen_qcbormap.go b/qt/gen_qcbormap.go
index 3f88865d..6bb05968 100644
--- a/qt/gen_qcbormap.go
+++ b/qt/gen_qcbormap.go
@@ -27,6 +27,9 @@ func (this *QCborMap) cPointer() *C.QCborMap {
 }
 
 func newQCborMap(h *C.QCborMap) *QCborMap {
+	if h == nil {
+		return nil
+	}
 	return &QCborMap{h: h}
 }
 
@@ -598,6 +601,9 @@ func (this *QCborMap__Iterator) cPointer() *C.QCborMap__Iterator {
 }
 
 func newQCborMap__Iterator(h *C.QCborMap__Iterator) *QCborMap__Iterator {
+	if h == nil {
+		return nil
+	}
 	return &QCborMap__Iterator{h: h}
 }
 
@@ -769,6 +775,9 @@ func (this *QCborMap__ConstIterator) cPointer() *C.QCborMap__ConstIterator {
 }
 
 func newQCborMap__ConstIterator(h *C.QCborMap__ConstIterator) *QCborMap__ConstIterator {
+	if h == nil {
+		return nil
+	}
 	return &QCborMap__ConstIterator{h: h}
 }
 
diff --git a/qt/gen_qcborstreamreader.go b/qt/gen_qcborstreamreader.go
index aa129df3..6e4f43fa 100644
--- a/qt/gen_qcborstreamreader.go
+++ b/qt/gen_qcborstreamreader.go
@@ -27,6 +27,9 @@ func (this *QCborStreamReader) cPointer() *C.QCborStreamReader {
 }
 
 func newQCborStreamReader(h *C.QCborStreamReader) *QCborStreamReader {
+	if h == nil {
+		return nil
+	}
 	return &QCborStreamReader{h: h}
 }
 
diff --git a/qt/gen_qcborstreamwriter.go b/qt/gen_qcborstreamwriter.go
index f8c755b0..7865f040 100644
--- a/qt/gen_qcborstreamwriter.go
+++ b/qt/gen_qcborstreamwriter.go
@@ -26,6 +26,9 @@ func (this *QCborStreamWriter) cPointer() *C.QCborStreamWriter {
 }
 
 func newQCborStreamWriter(h *C.QCborStreamWriter) *QCborStreamWriter {
+	if h == nil {
+		return nil
+	}
 	return &QCborStreamWriter{h: h}
 }
 
diff --git a/qt/gen_qcborvalue.go b/qt/gen_qcborvalue.go
index dfd90c0a..7420a029 100644
--- a/qt/gen_qcborvalue.go
+++ b/qt/gen_qcborvalue.go
@@ -27,6 +27,9 @@ func (this *QCborParserError) cPointer() *C.QCborParserError {
 }
 
 func newQCborParserError(h *C.QCborParserError) *QCborParserError {
+	if h == nil {
+		return nil
+	}
 	return &QCborParserError{h: h}
 }
 
@@ -59,6 +62,9 @@ func (this *QCborValue) cPointer() *C.QCborValue {
 }
 
 func newQCborValue(h *C.QCborValue) *QCborValue {
+	if h == nil {
+		return nil
+	}
 	return &QCborValue{h: h}
 }
 
@@ -763,6 +769,9 @@ func (this *QCborValueRef) cPointer() *C.QCborValueRef {
 }
 
 func newQCborValueRef(h *C.QCborValueRef) *QCborValueRef {
+	if h == nil {
+		return nil
+	}
 	return &QCborValueRef{h: h}
 }
 
diff --git a/qt/gen_qchar.go b/qt/gen_qchar.go
index b456621f..cd687b8f 100644
--- a/qt/gen_qchar.go
+++ b/qt/gen_qchar.go
@@ -27,6 +27,9 @@ func (this *QLatin1Char) cPointer() *C.QLatin1Char {
 }
 
 func newQLatin1Char(h *C.QLatin1Char) *QLatin1Char {
+	if h == nil {
+		return nil
+	}
 	return &QLatin1Char{h: h}
 }
 
@@ -72,6 +75,9 @@ func (this *QChar) cPointer() *C.QChar {
 }
 
 func newQChar(h *C.QChar) *QChar {
+	if h == nil {
+		return nil
+	}
 	return &QChar{h: h}
 }
 
diff --git a/qt/gen_qcheckbox.go b/qt/gen_qcheckbox.go
index 674e5b17..4a9e532f 100644
--- a/qt/gen_qcheckbox.go
+++ b/qt/gen_qcheckbox.go
@@ -29,6 +29,9 @@ func (this *QCheckBox) cPointer() *C.QCheckBox {
 }
 
 func newQCheckBox(h *C.QCheckBox) *QCheckBox {
+	if h == nil {
+		return nil
+	}
 	return &QCheckBox{h: h, QAbstractButton: newQAbstractButton_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qclipboard.go b/qt/gen_qclipboard.go
index 170153dc..1278cf0b 100644
--- a/qt/gen_qclipboard.go
+++ b/qt/gen_qclipboard.go
@@ -29,6 +29,9 @@ func (this *QClipboard) cPointer() *C.QClipboard {
 }
 
 func newQClipboard(h *C.QClipboard) *QClipboard {
+	if h == nil {
+		return nil
+	}
 	return &QClipboard{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcollator.go b/qt/gen_qcollator.go
index 63a9fb2d..d959b7d0 100644
--- a/qt/gen_qcollator.go
+++ b/qt/gen_qcollator.go
@@ -27,6 +27,9 @@ func (this *QCollatorSortKey) cPointer() *C.QCollatorSortKey {
 }
 
 func newQCollatorSortKey(h *C.QCollatorSortKey) *QCollatorSortKey {
+	if h == nil {
+		return nil
+	}
 	return &QCollatorSortKey{h: h}
 }
 
@@ -69,6 +72,9 @@ func (this *QCollator) cPointer() *C.QCollator {
 }
 
 func newQCollator(h *C.QCollator) *QCollator {
+	if h == nil {
+		return nil
+	}
 	return &QCollator{h: h}
 }
 
diff --git a/qt/gen_qcolor.go b/qt/gen_qcolor.go
index f311289e..16567734 100644
--- a/qt/gen_qcolor.go
+++ b/qt/gen_qcolor.go
@@ -27,6 +27,9 @@ func (this *QColor) cPointer() *C.QColor {
 }
 
 func newQColor(h *C.QColor) *QColor {
+	if h == nil {
+		return nil
+	}
 	return &QColor{h: h}
 }
 
diff --git a/qt/gen_qcolordialog.go b/qt/gen_qcolordialog.go
index bd3e8598..f978a4b3 100644
--- a/qt/gen_qcolordialog.go
+++ b/qt/gen_qcolordialog.go
@@ -29,6 +29,9 @@ func (this *QColorDialog) cPointer() *C.QColorDialog {
 }
 
 func newQColorDialog(h *C.QColorDialog) *QColorDialog {
+	if h == nil {
+		return nil
+	}
 	return &QColorDialog{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcolormap.go b/qt/gen_qcolormap.go
index 70091b7d..b8c911b9 100644
--- a/qt/gen_qcolormap.go
+++ b/qt/gen_qcolormap.go
@@ -27,6 +27,9 @@ func (this *QColormap) cPointer() *C.QColormap {
 }
 
 func newQColormap(h *C.QColormap) *QColormap {
+	if h == nil {
+		return nil
+	}
 	return &QColormap{h: h}
 }
 
diff --git a/qt/gen_qcolorspace.go b/qt/gen_qcolorspace.go
index efc6a3e3..bb024d76 100644
--- a/qt/gen_qcolorspace.go
+++ b/qt/gen_qcolorspace.go
@@ -27,6 +27,9 @@ func (this *QColorSpace) cPointer() *C.QColorSpace {
 }
 
 func newQColorSpace(h *C.QColorSpace) *QColorSpace {
+	if h == nil {
+		return nil
+	}
 	return &QColorSpace{h: h}
 }
 
diff --git a/qt/gen_qcolortransform.go b/qt/gen_qcolortransform.go
index c2cb1e85..ae3b8649 100644
--- a/qt/gen_qcolortransform.go
+++ b/qt/gen_qcolortransform.go
@@ -27,6 +27,9 @@ func (this *QColorTransform) cPointer() *C.QColorTransform {
 }
 
 func newQColorTransform(h *C.QColorTransform) *QColorTransform {
+	if h == nil {
+		return nil
+	}
 	return &QColorTransform{h: h}
 }
 
diff --git a/qt/gen_qcolumnview.go b/qt/gen_qcolumnview.go
index 7ae9d00f..49af4b9b 100644
--- a/qt/gen_qcolumnview.go
+++ b/qt/gen_qcolumnview.go
@@ -29,6 +29,9 @@ func (this *QColumnView) cPointer() *C.QColumnView {
 }
 
 func newQColumnView(h *C.QColumnView) *QColumnView {
+	if h == nil {
+		return nil
+	}
 	return &QColumnView{h: h, QAbstractItemView: newQAbstractItemView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcombobox.go b/qt/gen_qcombobox.go
index 52a5b006..ce7f3ca0 100644
--- a/qt/gen_qcombobox.go
+++ b/qt/gen_qcombobox.go
@@ -29,6 +29,9 @@ func (this *QComboBox) cPointer() *C.QComboBox {
 }
 
 func newQComboBox(h *C.QComboBox) *QComboBox {
+	if h == nil {
+		return nil
+	}
 	return &QComboBox{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcommandlineoption.go b/qt/gen_qcommandlineoption.go
index c3ab7e1e..4a79372f 100644
--- a/qt/gen_qcommandlineoption.go
+++ b/qt/gen_qcommandlineoption.go
@@ -26,6 +26,9 @@ func (this *QCommandLineOption) cPointer() *C.QCommandLineOption {
 }
 
 func newQCommandLineOption(h *C.QCommandLineOption) *QCommandLineOption {
+	if h == nil {
+		return nil
+	}
 	return &QCommandLineOption{h: h}
 }
 
diff --git a/qt/gen_qcommandlineparser.go b/qt/gen_qcommandlineparser.go
index e8791bad..7e5eb5c8 100644
--- a/qt/gen_qcommandlineparser.go
+++ b/qt/gen_qcommandlineparser.go
@@ -27,6 +27,9 @@ func (this *QCommandLineParser) cPointer() *C.QCommandLineParser {
 }
 
 func newQCommandLineParser(h *C.QCommandLineParser) *QCommandLineParser {
+	if h == nil {
+		return nil
+	}
 	return &QCommandLineParser{h: h}
 }
 
diff --git a/qt/gen_qcommandlinkbutton.go b/qt/gen_qcommandlinkbutton.go
index 3b0fb537..d26e2b66 100644
--- a/qt/gen_qcommandlinkbutton.go
+++ b/qt/gen_qcommandlinkbutton.go
@@ -27,6 +27,9 @@ func (this *QCommandLinkButton) cPointer() *C.QCommandLinkButton {
 }
 
 func newQCommandLinkButton(h *C.QCommandLinkButton) *QCommandLinkButton {
+	if h == nil {
+		return nil
+	}
 	return &QCommandLinkButton{h: h, QPushButton: newQPushButton_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcommonstyle.go b/qt/gen_qcommonstyle.go
index 1c46706e..2abdd4a4 100644
--- a/qt/gen_qcommonstyle.go
+++ b/qt/gen_qcommonstyle.go
@@ -28,6 +28,9 @@ func (this *QCommonStyle) cPointer() *C.QCommonStyle {
 }
 
 func newQCommonStyle(h *C.QCommonStyle) *QCommonStyle {
+	if h == nil {
+		return nil
+	}
 	return &QCommonStyle{h: h, QStyle: newQStyle_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcompleter.go b/qt/gen_qcompleter.go
index edd7bfb7..fe89ef6b 100644
--- a/qt/gen_qcompleter.go
+++ b/qt/gen_qcompleter.go
@@ -29,6 +29,9 @@ func (this *QCompleter) cPointer() *C.QCompleter {
 }
 
 func newQCompleter(h *C.QCompleter) *QCompleter {
+	if h == nil {
+		return nil
+	}
 	return &QCompleter{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qconcatenatetablesproxymodel.go b/qt/gen_qconcatenatetablesproxymodel.go
index 3d60d150..18559172 100644
--- a/qt/gen_qconcatenatetablesproxymodel.go
+++ b/qt/gen_qconcatenatetablesproxymodel.go
@@ -28,6 +28,9 @@ func (this *QConcatenateTablesProxyModel) cPointer() *C.QConcatenateTablesProxyM
 }
 
 func newQConcatenateTablesProxyModel(h *C.QConcatenateTablesProxyModel) *QConcatenateTablesProxyModel {
+	if h == nil {
+		return nil
+	}
 	return &QConcatenateTablesProxyModel{h: h, QAbstractItemModel: newQAbstractItemModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcontiguouscache.go b/qt/gen_qcontiguouscache.go
index 1ea86c69..d9bf9499 100644
--- a/qt/gen_qcontiguouscache.go
+++ b/qt/gen_qcontiguouscache.go
@@ -26,6 +26,9 @@ func (this *QContiguousCacheData) cPointer() *C.QContiguousCacheData {
 }
 
 func newQContiguousCacheData(h *C.QContiguousCacheData) *QContiguousCacheData {
+	if h == nil {
+		return nil
+	}
 	return &QContiguousCacheData{h: h}
 }
 
diff --git a/qt/gen_qcoreapplication.go b/qt/gen_qcoreapplication.go
index a73df76b..e4ba978a 100644
--- a/qt/gen_qcoreapplication.go
+++ b/qt/gen_qcoreapplication.go
@@ -28,6 +28,9 @@ func (this *QCoreApplication) cPointer() *C.QCoreApplication {
 }
 
 func newQCoreApplication(h *C.QCoreApplication) *QCoreApplication {
+	if h == nil {
+		return nil
+	}
 	return &QCoreApplication{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcoreevent.go b/qt/gen_qcoreevent.go
index 38d2cafd..8dc29b1e 100644
--- a/qt/gen_qcoreevent.go
+++ b/qt/gen_qcoreevent.go
@@ -27,6 +27,9 @@ func (this *QEvent) cPointer() *C.QEvent {
 }
 
 func newQEvent(h *C.QEvent) *QEvent {
+	if h == nil {
+		return nil
+	}
 	return &QEvent{h: h}
 }
 
@@ -104,6 +107,9 @@ func (this *QTimerEvent) cPointer() *C.QTimerEvent {
 }
 
 func newQTimerEvent(h *C.QTimerEvent) *QTimerEvent {
+	if h == nil {
+		return nil
+	}
 	return &QTimerEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -145,6 +151,9 @@ func (this *QChildEvent) cPointer() *C.QChildEvent {
 }
 
 func newQChildEvent(h *C.QChildEvent) *QChildEvent {
+	if h == nil {
+		return nil
+	}
 	return &QChildEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -201,6 +210,9 @@ func (this *QDynamicPropertyChangeEvent) cPointer() *C.QDynamicPropertyChangeEve
 }
 
 func newQDynamicPropertyChangeEvent(h *C.QDynamicPropertyChangeEvent) *QDynamicPropertyChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QDynamicPropertyChangeEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -248,6 +260,9 @@ func (this *QDeferredDeleteEvent) cPointer() *C.QDeferredDeleteEvent {
 }
 
 func newQDeferredDeleteEvent(h *C.QDeferredDeleteEvent) *QDeferredDeleteEvent {
+	if h == nil {
+		return nil
+	}
 	return &QDeferredDeleteEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qcryptographichash.go b/qt/gen_qcryptographichash.go
index 162a4119..9cb15679 100644
--- a/qt/gen_qcryptographichash.go
+++ b/qt/gen_qcryptographichash.go
@@ -27,6 +27,9 @@ func (this *QCryptographicHash) cPointer() *C.QCryptographicHash {
 }
 
 func newQCryptographicHash(h *C.QCryptographicHash) *QCryptographicHash {
+	if h == nil {
+		return nil
+	}
 	return &QCryptographicHash{h: h}
 }
 
diff --git a/qt/gen_qcursor.go b/qt/gen_qcursor.go
index 42d33683..213899bf 100644
--- a/qt/gen_qcursor.go
+++ b/qt/gen_qcursor.go
@@ -27,6 +27,9 @@ func (this *QCursor) cPointer() *C.QCursor {
 }
 
 func newQCursor(h *C.QCursor) *QCursor {
+	if h == nil {
+		return nil
+	}
 	return &QCursor{h: h}
 }
 
diff --git a/qt/gen_qdatastream.go b/qt/gen_qdatastream.go
index 445d9156..e0061df2 100644
--- a/qt/gen_qdatastream.go
+++ b/qt/gen_qdatastream.go
@@ -26,6 +26,9 @@ func (this *QDataStream) cPointer() *C.QDataStream {
 }
 
 func newQDataStream(h *C.QDataStream) *QDataStream {
+	if h == nil {
+		return nil
+	}
 	return &QDataStream{h: h}
 }
 
@@ -280,6 +283,9 @@ func (this *QtPrivate__StreamStateSaver) cPointer() *C.QtPrivate__StreamStateSav
 }
 
 func newQtPrivate__StreamStateSaver(h *C.QtPrivate__StreamStateSaver) *QtPrivate__StreamStateSaver {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__StreamStateSaver{h: h}
 }
 
diff --git a/qt/gen_qdatawidgetmapper.go b/qt/gen_qdatawidgetmapper.go
index 5c44d27b..c79b3812 100644
--- a/qt/gen_qdatawidgetmapper.go
+++ b/qt/gen_qdatawidgetmapper.go
@@ -29,6 +29,9 @@ func (this *QDataWidgetMapper) cPointer() *C.QDataWidgetMapper {
 }
 
 func newQDataWidgetMapper(h *C.QDataWidgetMapper) *QDataWidgetMapper {
+	if h == nil {
+		return nil
+	}
 	return &QDataWidgetMapper{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdatetime.go b/qt/gen_qdatetime.go
index bd5bf980..1cb392f9 100644
--- a/qt/gen_qdatetime.go
+++ b/qt/gen_qdatetime.go
@@ -27,6 +27,9 @@ func (this *QDate) cPointer() *C.QDate {
 }
 
 func newQDate(h *C.QDate) *QDate {
+	if h == nil {
+		return nil
+	}
 	return &QDate{h: h}
 }
 
@@ -574,6 +577,9 @@ func (this *QTime) cPointer() *C.QTime {
 }
 
 func newQTime(h *C.QTime) *QTime {
+	if h == nil {
+		return nil
+	}
 	return &QTime{h: h}
 }
 
@@ -850,6 +856,9 @@ func (this *QDateTime) cPointer() *C.QDateTime {
 }
 
 func newQDateTime(h *C.QDateTime) *QDateTime {
+	if h == nil {
+		return nil
+	}
 	return &QDateTime{h: h}
 }
 
diff --git a/qt/gen_qdatetimeedit.go b/qt/gen_qdatetimeedit.go
index 687f2299..134ba3a0 100644
--- a/qt/gen_qdatetimeedit.go
+++ b/qt/gen_qdatetimeedit.go
@@ -29,6 +29,9 @@ func (this *QDateTimeEdit) cPointer() *C.QDateTimeEdit {
 }
 
 func newQDateTimeEdit(h *C.QDateTimeEdit) *QDateTimeEdit {
+	if h == nil {
+		return nil
+	}
 	return &QDateTimeEdit{h: h, QAbstractSpinBox: newQAbstractSpinBox_U(unsafe.Pointer(h))}
 }
 
@@ -514,6 +517,9 @@ func (this *QTimeEdit) cPointer() *C.QTimeEdit {
 }
 
 func newQTimeEdit(h *C.QTimeEdit) *QTimeEdit {
+	if h == nil {
+		return nil
+	}
 	return &QTimeEdit{h: h, QDateTimeEdit: newQDateTimeEdit_U(unsafe.Pointer(h))}
 }
 
@@ -653,6 +659,9 @@ func (this *QDateEdit) cPointer() *C.QDateEdit {
 }
 
 func newQDateEdit(h *C.QDateEdit) *QDateEdit {
+	if h == nil {
+		return nil
+	}
 	return &QDateEdit{h: h, QDateTimeEdit: newQDateTimeEdit_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdeadlinetimer.go b/qt/gen_qdeadlinetimer.go
index fa3c13f8..565e752d 100644
--- a/qt/gen_qdeadlinetimer.go
+++ b/qt/gen_qdeadlinetimer.go
@@ -27,6 +27,9 @@ func (this *QDeadlineTimer) cPointer() *C.QDeadlineTimer {
 }
 
 func newQDeadlineTimer(h *C.QDeadlineTimer) *QDeadlineTimer {
+	if h == nil {
+		return nil
+	}
 	return &QDeadlineTimer{h: h}
 }
 
diff --git a/qt/gen_qdebug.go b/qt/gen_qdebug.go
index f4107845..76d1b201 100644
--- a/qt/gen_qdebug.go
+++ b/qt/gen_qdebug.go
@@ -26,6 +26,9 @@ func (this *QDebug) cPointer() *C.QDebug {
 }
 
 func newQDebug(h *C.QDebug) *QDebug {
+	if h == nil {
+		return nil
+	}
 	return &QDebug{h: h}
 }
 
@@ -216,6 +219,9 @@ func (this *QDebugStateSaver) cPointer() *C.QDebugStateSaver {
 }
 
 func newQDebugStateSaver(h *C.QDebugStateSaver) *QDebugStateSaver {
+	if h == nil {
+		return nil
+	}
 	return &QDebugStateSaver{h: h}
 }
 
@@ -245,6 +251,9 @@ func (this *QNoDebug) cPointer() *C.QNoDebug {
 }
 
 func newQNoDebug(h *C.QNoDebug) *QNoDebug {
+	if h == nil {
+		return nil
+	}
 	return &QNoDebug{h: h}
 }
 
diff --git a/qt/gen_qdesktopservices.go b/qt/gen_qdesktopservices.go
index 6abaa673..36b91e70 100644
--- a/qt/gen_qdesktopservices.go
+++ b/qt/gen_qdesktopservices.go
@@ -26,6 +26,9 @@ func (this *QDesktopServices) cPointer() *C.QDesktopServices {
 }
 
 func newQDesktopServices(h *C.QDesktopServices) *QDesktopServices {
+	if h == nil {
+		return nil
+	}
 	return &QDesktopServices{h: h}
 }
 
diff --git a/qt/gen_qdesktopwidget.go b/qt/gen_qdesktopwidget.go
index 41b055d2..e5a33a92 100644
--- a/qt/gen_qdesktopwidget.go
+++ b/qt/gen_qdesktopwidget.go
@@ -29,6 +29,9 @@ func (this *QDesktopWidget) cPointer() *C.QDesktopWidget {
 }
 
 func newQDesktopWidget(h *C.QDesktopWidget) *QDesktopWidget {
+	if h == nil {
+		return nil
+	}
 	return &QDesktopWidget{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdial.go b/qt/gen_qdial.go
index 467302f1..1db70481 100644
--- a/qt/gen_qdial.go
+++ b/qt/gen_qdial.go
@@ -28,6 +28,9 @@ func (this *QDial) cPointer() *C.QDial {
 }
 
 func newQDial(h *C.QDial) *QDial {
+	if h == nil {
+		return nil
+	}
 	return &QDial{h: h, QAbstractSlider: newQAbstractSlider_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdialog.go b/qt/gen_qdialog.go
index 0a1f7883..721d58b1 100644
--- a/qt/gen_qdialog.go
+++ b/qt/gen_qdialog.go
@@ -29,6 +29,9 @@ func (this *QDialog) cPointer() *C.QDialog {
 }
 
 func newQDialog(h *C.QDialog) *QDialog {
+	if h == nil {
+		return nil
+	}
 	return &QDialog{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdialogbuttonbox.go b/qt/gen_qdialogbuttonbox.go
index aa5762da..23597b64 100644
--- a/qt/gen_qdialogbuttonbox.go
+++ b/qt/gen_qdialogbuttonbox.go
@@ -28,6 +28,9 @@ func (this *QDialogButtonBox) cPointer() *C.QDialogButtonBox {
 }
 
 func newQDialogButtonBox(h *C.QDialogButtonBox) *QDialogButtonBox {
+	if h == nil {
+		return nil
+	}
 	return &QDialogButtonBox{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdir.go b/qt/gen_qdir.go
index 030e42b2..4787ae47 100644
--- a/qt/gen_qdir.go
+++ b/qt/gen_qdir.go
@@ -27,6 +27,9 @@ func (this *QDir) cPointer() *C.QDir {
 }
 
 func newQDir(h *C.QDir) *QDir {
+	if h == nil {
+		return nil
+	}
 	return &QDir{h: h}
 }
 
diff --git a/qt/gen_qdiriterator.go b/qt/gen_qdiriterator.go
index ee6dfdd8..dd08deea 100644
--- a/qt/gen_qdiriterator.go
+++ b/qt/gen_qdiriterator.go
@@ -27,6 +27,9 @@ func (this *QDirIterator) cPointer() *C.QDirIterator {
 }
 
 func newQDirIterator(h *C.QDirIterator) *QDirIterator {
+	if h == nil {
+		return nil
+	}
 	return &QDirIterator{h: h}
 }
 
diff --git a/qt/gen_qdirmodel.go b/qt/gen_qdirmodel.go
index 483ee109..fbf3f5f2 100644
--- a/qt/gen_qdirmodel.go
+++ b/qt/gen_qdirmodel.go
@@ -28,6 +28,9 @@ func (this *QDirModel) cPointer() *C.QDirModel {
 }
 
 func newQDirModel(h *C.QDirModel) *QDirModel {
+	if h == nil {
+		return nil
+	}
 	return &QDirModel{h: h, QAbstractItemModel: newQAbstractItemModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdockwidget.go b/qt/gen_qdockwidget.go
index 8eb3ff6e..7ba3644f 100644
--- a/qt/gen_qdockwidget.go
+++ b/qt/gen_qdockwidget.go
@@ -28,6 +28,9 @@ func (this *QDockWidget) cPointer() *C.QDockWidget {
 }
 
 func newQDockWidget(h *C.QDockWidget) *QDockWidget {
+	if h == nil {
+		return nil
+	}
 	return &QDockWidget{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdrag.go b/qt/gen_qdrag.go
index 3684d683..68a62ef3 100644
--- a/qt/gen_qdrag.go
+++ b/qt/gen_qdrag.go
@@ -29,6 +29,9 @@ func (this *QDrag) cPointer() *C.QDrag {
 }
 
 func newQDrag(h *C.QDrag) *QDrag {
+	if h == nil {
+		return nil
+	}
 	return &QDrag{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qdrawutil.go b/qt/gen_qdrawutil.go
index 12fd3945..df3f915f 100644
--- a/qt/gen_qdrawutil.go
+++ b/qt/gen_qdrawutil.go
@@ -26,6 +26,9 @@ func (this *QTileRules) cPointer() *C.QTileRules {
 }
 
 func newQTileRules(h *C.QTileRules) *QTileRules {
+	if h == nil {
+		return nil
+	}
 	return &QTileRules{h: h}
 }
 
diff --git a/qt/gen_qeasingcurve.go b/qt/gen_qeasingcurve.go
index 5e3a05eb..810bcd85 100644
--- a/qt/gen_qeasingcurve.go
+++ b/qt/gen_qeasingcurve.go
@@ -26,6 +26,9 @@ func (this *QEasingCurve) cPointer() *C.QEasingCurve {
 }
 
 func newQEasingCurve(h *C.QEasingCurve) *QEasingCurve {
+	if h == nil {
+		return nil
+	}
 	return &QEasingCurve{h: h}
 }
 
diff --git a/qt/gen_qelapsedtimer.go b/qt/gen_qelapsedtimer.go
index 8a95e0cc..ba126d9c 100644
--- a/qt/gen_qelapsedtimer.go
+++ b/qt/gen_qelapsedtimer.go
@@ -26,6 +26,9 @@ func (this *QElapsedTimer) cPointer() *C.QElapsedTimer {
 }
 
 func newQElapsedTimer(h *C.QElapsedTimer) *QElapsedTimer {
+	if h == nil {
+		return nil
+	}
 	return &QElapsedTimer{h: h}
 }
 
diff --git a/qt/gen_qerrormessage.go b/qt/gen_qerrormessage.go
index 68267fa8..7a092be0 100644
--- a/qt/gen_qerrormessage.go
+++ b/qt/gen_qerrormessage.go
@@ -27,6 +27,9 @@ func (this *QErrorMessage) cPointer() *C.QErrorMessage {
 }
 
 func newQErrorMessage(h *C.QErrorMessage) *QErrorMessage {
+	if h == nil {
+		return nil
+	}
 	return &QErrorMessage{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qevent.go b/qt/gen_qevent.go
index d9e3b2b8..7dac585e 100644
--- a/qt/gen_qevent.go
+++ b/qt/gen_qevent.go
@@ -28,6 +28,9 @@ func (this *QInputEvent) cPointer() *C.QInputEvent {
 }
 
 func newQInputEvent(h *C.QInputEvent) *QInputEvent {
+	if h == nil {
+		return nil
+	}
 	return &QInputEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -88,6 +91,9 @@ func (this *QEnterEvent) cPointer() *C.QEnterEvent {
 }
 
 func newQEnterEvent(h *C.QEnterEvent) *QEnterEvent {
+	if h == nil {
+		return nil
+	}
 	return &QEnterEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -181,6 +187,9 @@ func (this *QMouseEvent) cPointer() *C.QMouseEvent {
 }
 
 func newQMouseEvent(h *C.QMouseEvent) *QMouseEvent {
+	if h == nil {
+		return nil
+	}
 	return &QMouseEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -316,6 +325,9 @@ func (this *QHoverEvent) cPointer() *C.QHoverEvent {
 }
 
 func newQHoverEvent(h *C.QHoverEvent) *QHoverEvent {
+	if h == nil {
+		return nil
+	}
 	return &QHoverEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -390,6 +402,9 @@ func (this *QWheelEvent) cPointer() *C.QWheelEvent {
 }
 
 func newQWheelEvent(h *C.QWheelEvent) *QWheelEvent {
+	if h == nil {
+		return nil
+	}
 	return &QWheelEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -606,6 +621,9 @@ func (this *QTabletEvent) cPointer() *C.QTabletEvent {
 }
 
 func newQTabletEvent(h *C.QTabletEvent) *QTabletEvent {
+	if h == nil {
+		return nil
+	}
 	return &QTabletEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -770,6 +788,9 @@ func (this *QNativeGestureEvent) cPointer() *C.QNativeGestureEvent {
 }
 
 func newQNativeGestureEvent(h *C.QNativeGestureEvent) *QNativeGestureEvent {
+	if h == nil {
+		return nil
+	}
 	return &QNativeGestureEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -864,6 +885,9 @@ func (this *QKeyEvent) cPointer() *C.QKeyEvent {
 }
 
 func newQKeyEvent(h *C.QKeyEvent) *QKeyEvent {
+	if h == nil {
+		return nil
+	}
 	return &QKeyEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1003,6 +1027,9 @@ func (this *QFocusEvent) cPointer() *C.QFocusEvent {
 }
 
 func newQFocusEvent(h *C.QFocusEvent) *QFocusEvent {
+	if h == nil {
+		return nil
+	}
 	return &QFocusEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1060,6 +1087,9 @@ func (this *QPaintEvent) cPointer() *C.QPaintEvent {
 }
 
 func newQPaintEvent(h *C.QPaintEvent) *QPaintEvent {
+	if h == nil {
+		return nil
+	}
 	return &QPaintEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1112,6 +1142,9 @@ func (this *QMoveEvent) cPointer() *C.QMoveEvent {
 }
 
 func newQMoveEvent(h *C.QMoveEvent) *QMoveEvent {
+	if h == nil {
+		return nil
+	}
 	return &QMoveEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1158,6 +1191,9 @@ func (this *QExposeEvent) cPointer() *C.QExposeEvent {
 }
 
 func newQExposeEvent(h *C.QExposeEvent) *QExposeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QExposeEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1199,6 +1235,9 @@ func (this *QPlatformSurfaceEvent) cPointer() *C.QPlatformSurfaceEvent {
 }
 
 func newQPlatformSurfaceEvent(h *C.QPlatformSurfaceEvent) *QPlatformSurfaceEvent {
+	if h == nil {
+		return nil
+	}
 	return &QPlatformSurfaceEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1240,6 +1279,9 @@ func (this *QResizeEvent) cPointer() *C.QResizeEvent {
 }
 
 func newQResizeEvent(h *C.QResizeEvent) *QResizeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QResizeEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1286,6 +1328,9 @@ func (this *QCloseEvent) cPointer() *C.QCloseEvent {
 }
 
 func newQCloseEvent(h *C.QCloseEvent) *QCloseEvent {
+	if h == nil {
+		return nil
+	}
 	return &QCloseEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1326,6 +1371,9 @@ func (this *QIconDragEvent) cPointer() *C.QIconDragEvent {
 }
 
 func newQIconDragEvent(h *C.QIconDragEvent) *QIconDragEvent {
+	if h == nil {
+		return nil
+	}
 	return &QIconDragEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1366,6 +1414,9 @@ func (this *QShowEvent) cPointer() *C.QShowEvent {
 }
 
 func newQShowEvent(h *C.QShowEvent) *QShowEvent {
+	if h == nil {
+		return nil
+	}
 	return &QShowEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1406,6 +1457,9 @@ func (this *QHideEvent) cPointer() *C.QHideEvent {
 }
 
 func newQHideEvent(h *C.QHideEvent) *QHideEvent {
+	if h == nil {
+		return nil
+	}
 	return &QHideEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1446,6 +1500,9 @@ func (this *QContextMenuEvent) cPointer() *C.QContextMenuEvent {
 }
 
 func newQContextMenuEvent(h *C.QContextMenuEvent) *QContextMenuEvent {
+	if h == nil {
+		return nil
+	}
 	return &QContextMenuEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1529,6 +1586,9 @@ func (this *QInputMethodEvent) cPointer() *C.QInputMethodEvent {
 }
 
 func newQInputMethodEvent(h *C.QInputMethodEvent) *QInputMethodEvent {
+	if h == nil {
+		return nil
+	}
 	return &QInputMethodEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1625,6 +1685,9 @@ func (this *QInputMethodQueryEvent) cPointer() *C.QInputMethodQueryEvent {
 }
 
 func newQInputMethodQueryEvent(h *C.QInputMethodQueryEvent) *QInputMethodQueryEvent {
+	if h == nil {
+		return nil
+	}
 	return &QInputMethodQueryEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1681,6 +1744,9 @@ func (this *QDropEvent) cPointer() *C.QDropEvent {
 }
 
 func newQDropEvent(h *C.QDropEvent) *QDropEvent {
+	if h == nil {
+		return nil
+	}
 	return &QDropEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1782,6 +1848,9 @@ func (this *QDragMoveEvent) cPointer() *C.QDragMoveEvent {
 }
 
 func newQDragMoveEvent(h *C.QDragMoveEvent) *QDragMoveEvent {
+	if h == nil {
+		return nil
+	}
 	return &QDragMoveEvent{h: h, QDropEvent: newQDropEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1851,6 +1920,9 @@ func (this *QDragEnterEvent) cPointer() *C.QDragEnterEvent {
 }
 
 func newQDragEnterEvent(h *C.QDragEnterEvent) *QDragEnterEvent {
+	if h == nil {
+		return nil
+	}
 	return &QDragEnterEvent{h: h, QDragMoveEvent: newQDragMoveEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1891,6 +1963,9 @@ func (this *QDragLeaveEvent) cPointer() *C.QDragLeaveEvent {
 }
 
 func newQDragLeaveEvent(h *C.QDragLeaveEvent) *QDragLeaveEvent {
+	if h == nil {
+		return nil
+	}
 	return &QDragLeaveEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1931,6 +2006,9 @@ func (this *QHelpEvent) cPointer() *C.QHelpEvent {
 }
 
 func newQHelpEvent(h *C.QHelpEvent) *QHelpEvent {
+	if h == nil {
+		return nil
+	}
 	return &QHelpEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -1997,6 +2075,9 @@ func (this *QStatusTipEvent) cPointer() *C.QStatusTipEvent {
 }
 
 func newQStatusTipEvent(h *C.QStatusTipEvent) *QStatusTipEvent {
+	if h == nil {
+		return nil
+	}
 	return &QStatusTipEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2044,6 +2125,9 @@ func (this *QWhatsThisClickedEvent) cPointer() *C.QWhatsThisClickedEvent {
 }
 
 func newQWhatsThisClickedEvent(h *C.QWhatsThisClickedEvent) *QWhatsThisClickedEvent {
+	if h == nil {
+		return nil
+	}
 	return &QWhatsThisClickedEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2091,6 +2175,9 @@ func (this *QActionEvent) cPointer() *C.QActionEvent {
 }
 
 func newQActionEvent(h *C.QActionEvent) *QActionEvent {
+	if h == nil {
+		return nil
+	}
 	return &QActionEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2147,6 +2234,9 @@ func (this *QFileOpenEvent) cPointer() *C.QFileOpenEvent {
 }
 
 func newQFileOpenEvent(h *C.QFileOpenEvent) *QFileOpenEvent {
+	if h == nil {
+		return nil
+	}
 	return &QFileOpenEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2216,6 +2306,9 @@ func (this *QToolBarChangeEvent) cPointer() *C.QToolBarChangeEvent {
 }
 
 func newQToolBarChangeEvent(h *C.QToolBarChangeEvent) *QToolBarChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QToolBarChangeEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2257,6 +2350,9 @@ func (this *QShortcutEvent) cPointer() *C.QShortcutEvent {
 }
 
 func newQShortcutEvent(h *C.QShortcutEvent) *QShortcutEvent {
+	if h == nil {
+		return nil
+	}
 	return &QShortcutEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2314,6 +2410,9 @@ func (this *QWindowStateChangeEvent) cPointer() *C.QWindowStateChangeEvent {
 }
 
 func newQWindowStateChangeEvent(h *C.QWindowStateChangeEvent) *QWindowStateChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QWindowStateChangeEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2365,6 +2464,9 @@ func (this *QPointingDeviceUniqueId) cPointer() *C.QPointingDeviceUniqueId {
 }
 
 func newQPointingDeviceUniqueId(h *C.QPointingDeviceUniqueId) *QPointingDeviceUniqueId {
+	if h == nil {
+		return nil
+	}
 	return &QPointingDeviceUniqueId{h: h}
 }
 
@@ -2422,6 +2524,9 @@ func (this *QTouchEvent) cPointer() *C.QTouchEvent {
 }
 
 func newQTouchEvent(h *C.QTouchEvent) *QTouchEvent {
+	if h == nil {
+		return nil
+	}
 	return &QTouchEvent{h: h, QInputEvent: newQInputEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2534,6 +2639,9 @@ func (this *QScrollPrepareEvent) cPointer() *C.QScrollPrepareEvent {
 }
 
 func newQScrollPrepareEvent(h *C.QScrollPrepareEvent) *QScrollPrepareEvent {
+	if h == nil {
+		return nil
+	}
 	return &QScrollPrepareEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2626,6 +2734,9 @@ func (this *QScrollEvent) cPointer() *C.QScrollEvent {
 }
 
 func newQScrollEvent(h *C.QScrollEvent) *QScrollEvent {
+	if h == nil {
+		return nil
+	}
 	return &QScrollEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2689,6 +2800,9 @@ func (this *QScreenOrientationChangeEvent) cPointer() *C.QScreenOrientationChang
 }
 
 func newQScreenOrientationChangeEvent(h *C.QScreenOrientationChangeEvent) *QScreenOrientationChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QScreenOrientationChangeEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2735,6 +2849,9 @@ func (this *QApplicationStateChangeEvent) cPointer() *C.QApplicationStateChangeE
 }
 
 func newQApplicationStateChangeEvent(h *C.QApplicationStateChangeEvent) *QApplicationStateChangeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QApplicationStateChangeEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -2775,6 +2892,9 @@ func (this *QInputMethodEvent__Attribute) cPointer() *C.QInputMethodEvent__Attri
 }
 
 func newQInputMethodEvent__Attribute(h *C.QInputMethodEvent__Attribute) *QInputMethodEvent__Attribute {
+	if h == nil {
+		return nil
+	}
 	return &QInputMethodEvent__Attribute{h: h}
 }
 
@@ -2816,6 +2936,9 @@ func (this *QTouchEvent__TouchPoint) cPointer() *C.QTouchEvent__TouchPoint {
 }
 
 func newQTouchEvent__TouchPoint(h *C.QTouchEvent__TouchPoint) *QTouchEvent__TouchPoint {
+	if h == nil {
+		return nil
+	}
 	return &QTouchEvent__TouchPoint{h: h}
 }
 
diff --git a/qt/gen_qeventloop.go b/qt/gen_qeventloop.go
index 2851a149..3e7a81b8 100644
--- a/qt/gen_qeventloop.go
+++ b/qt/gen_qeventloop.go
@@ -27,6 +27,9 @@ func (this *QEventLoop) cPointer() *C.QEventLoop {
 }
 
 func newQEventLoop(h *C.QEventLoop) *QEventLoop {
+	if h == nil {
+		return nil
+	}
 	return &QEventLoop{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -191,6 +194,9 @@ func (this *QEventLoopLocker) cPointer() *C.QEventLoopLocker {
 }
 
 func newQEventLoopLocker(h *C.QEventLoopLocker) *QEventLoopLocker {
+	if h == nil {
+		return nil
+	}
 	return &QEventLoopLocker{h: h}
 }
 
diff --git a/qt/gen_qeventtransition.go b/qt/gen_qeventtransition.go
index b3f628c5..240cf264 100644
--- a/qt/gen_qeventtransition.go
+++ b/qt/gen_qeventtransition.go
@@ -27,6 +27,9 @@ func (this *QEventTransition) cPointer() *C.QEventTransition {
 }
 
 func newQEventTransition(h *C.QEventTransition) *QEventTransition {
+	if h == nil {
+		return nil
+	}
 	return &QEventTransition{h: h, QAbstractTransition: newQAbstractTransition_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qexception.go b/qt/gen_qexception.go
index 079adf29..1b136a8a 100644
--- a/qt/gen_qexception.go
+++ b/qt/gen_qexception.go
@@ -27,6 +27,9 @@ func (this *QtPrivate__ExceptionHolder) cPointer() *C.QtPrivate__ExceptionHolder
 }
 
 func newQtPrivate__ExceptionHolder(h *C.QtPrivate__ExceptionHolder) *QtPrivate__ExceptionHolder {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__ExceptionHolder{h: h}
 }
 
@@ -66,6 +69,9 @@ func (this *QtPrivate__ExceptionStore) cPointer() *C.QtPrivate__ExceptionStore {
 }
 
 func newQtPrivate__ExceptionStore(h *C.QtPrivate__ExceptionStore) *QtPrivate__ExceptionStore {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__ExceptionStore{h: h}
 }
 
diff --git a/qt/gen_qfactoryinterface.go b/qt/gen_qfactoryinterface.go
index 2add7640..af2a516d 100644
--- a/qt/gen_qfactoryinterface.go
+++ b/qt/gen_qfactoryinterface.go
@@ -26,6 +26,9 @@ func (this *QFactoryInterface) cPointer() *C.QFactoryInterface {
 }
 
 func newQFactoryInterface(h *C.QFactoryInterface) *QFactoryInterface {
+	if h == nil {
+		return nil
+	}
 	return &QFactoryInterface{h: h}
 }
 
diff --git a/qt/gen_qfile.go b/qt/gen_qfile.go
index 5dc871ca..3239b77a 100644
--- a/qt/gen_qfile.go
+++ b/qt/gen_qfile.go
@@ -28,6 +28,9 @@ func (this *QFile) cPointer() *C.QFile {
 }
 
 func newQFile(h *C.QFile) *QFile {
+	if h == nil {
+		return nil
+	}
 	return &QFile{h: h, QFileDevice: newQFileDevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfiledevice.go b/qt/gen_qfiledevice.go
index 6fcfed8c..1efd8dd5 100644
--- a/qt/gen_qfiledevice.go
+++ b/qt/gen_qfiledevice.go
@@ -28,6 +28,9 @@ func (this *QFileDevice) cPointer() *C.QFileDevice {
 }
 
 func newQFileDevice(h *C.QFileDevice) *QFileDevice {
+	if h == nil {
+		return nil
+	}
 	return &QFileDevice{h: h, QIODevice: newQIODevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfiledialog.go b/qt/gen_qfiledialog.go
index ca89594e..4c42831d 100644
--- a/qt/gen_qfiledialog.go
+++ b/qt/gen_qfiledialog.go
@@ -29,6 +29,9 @@ func (this *QFileDialog) cPointer() *C.QFileDialog {
 }
 
 func newQFileDialog(h *C.QFileDialog) *QFileDialog {
+	if h == nil {
+		return nil
+	}
 	return &QFileDialog{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfileiconprovider.go b/qt/gen_qfileiconprovider.go
index a4041f9f..905d41fa 100644
--- a/qt/gen_qfileiconprovider.go
+++ b/qt/gen_qfileiconprovider.go
@@ -27,6 +27,9 @@ func (this *QFileIconProvider) cPointer() *C.QFileIconProvider {
 }
 
 func newQFileIconProvider(h *C.QFileIconProvider) *QFileIconProvider {
+	if h == nil {
+		return nil
+	}
 	return &QFileIconProvider{h: h}
 }
 
diff --git a/qt/gen_qfileinfo.go b/qt/gen_qfileinfo.go
index 32663467..4b324c34 100644
--- a/qt/gen_qfileinfo.go
+++ b/qt/gen_qfileinfo.go
@@ -27,6 +27,9 @@ func (this *QFileInfo) cPointer() *C.QFileInfo {
 }
 
 func newQFileInfo(h *C.QFileInfo) *QFileInfo {
+	if h == nil {
+		return nil
+	}
 	return &QFileInfo{h: h}
 }
 
diff --git a/qt/gen_qfileselector.go b/qt/gen_qfileselector.go
index 0b9afd3b..84f63ccf 100644
--- a/qt/gen_qfileselector.go
+++ b/qt/gen_qfileselector.go
@@ -28,6 +28,9 @@ func (this *QFileSelector) cPointer() *C.QFileSelector {
 }
 
 func newQFileSelector(h *C.QFileSelector) *QFileSelector {
+	if h == nil {
+		return nil
+	}
 	return &QFileSelector{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfilesystemmodel.go b/qt/gen_qfilesystemmodel.go
index 01070e1a..3d53c9f7 100644
--- a/qt/gen_qfilesystemmodel.go
+++ b/qt/gen_qfilesystemmodel.go
@@ -29,6 +29,9 @@ func (this *QFileSystemModel) cPointer() *C.QFileSystemModel {
 }
 
 func newQFileSystemModel(h *C.QFileSystemModel) *QFileSystemModel {
+	if h == nil {
+		return nil
+	}
 	return &QFileSystemModel{h: h, QAbstractItemModel: newQAbstractItemModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfilesystemwatcher.go b/qt/gen_qfilesystemwatcher.go
index 2a9fd5be..36c01346 100644
--- a/qt/gen_qfilesystemwatcher.go
+++ b/qt/gen_qfilesystemwatcher.go
@@ -27,6 +27,9 @@ func (this *QFileSystemWatcher) cPointer() *C.QFileSystemWatcher {
 }
 
 func newQFileSystemWatcher(h *C.QFileSystemWatcher) *QFileSystemWatcher {
+	if h == nil {
+		return nil
+	}
 	return &QFileSystemWatcher{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfinalstate.go b/qt/gen_qfinalstate.go
index fc444f97..cb9af659 100644
--- a/qt/gen_qfinalstate.go
+++ b/qt/gen_qfinalstate.go
@@ -27,6 +27,9 @@ func (this *QFinalState) cPointer() *C.QFinalState {
 }
 
 func newQFinalState(h *C.QFinalState) *QFinalState {
+	if h == nil {
+		return nil
+	}
 	return &QFinalState{h: h, QAbstractState: newQAbstractState_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfloat16.go b/qt/gen_qfloat16.go
index 983ea11a..7f155c25 100644
--- a/qt/gen_qfloat16.go
+++ b/qt/gen_qfloat16.go
@@ -26,6 +26,9 @@ func (this *qfloat16) cPointer() *C.qfloat16 {
 }
 
 func newqfloat16(h *C.qfloat16) *qfloat16 {
+	if h == nil {
+		return nil
+	}
 	return &qfloat16{h: h}
 }
 
diff --git a/qt/gen_qfocusframe.go b/qt/gen_qfocusframe.go
index f6a25ba2..4ef40923 100644
--- a/qt/gen_qfocusframe.go
+++ b/qt/gen_qfocusframe.go
@@ -27,6 +27,9 @@ func (this *QFocusFrame) cPointer() *C.QFocusFrame {
 }
 
 func newQFocusFrame(h *C.QFocusFrame) *QFocusFrame {
+	if h == nil {
+		return nil
+	}
 	return &QFocusFrame{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfont.go b/qt/gen_qfont.go
index def63691..f34d43f4 100644
--- a/qt/gen_qfont.go
+++ b/qt/gen_qfont.go
@@ -27,6 +27,9 @@ func (this *QFont) cPointer() *C.QFont {
 }
 
 func newQFont(h *C.QFont) *QFont {
+	if h == nil {
+		return nil
+	}
 	return &QFont{h: h}
 }
 
diff --git a/qt/gen_qfontcombobox.go b/qt/gen_qfontcombobox.go
index 9b18feea..440aa35e 100644
--- a/qt/gen_qfontcombobox.go
+++ b/qt/gen_qfontcombobox.go
@@ -29,6 +29,9 @@ func (this *QFontComboBox) cPointer() *C.QFontComboBox {
 }
 
 func newQFontComboBox(h *C.QFontComboBox) *QFontComboBox {
+	if h == nil {
+		return nil
+	}
 	return &QFontComboBox{h: h, QComboBox: newQComboBox_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfontdatabase.go b/qt/gen_qfontdatabase.go
index 14575cd3..090e9b29 100644
--- a/qt/gen_qfontdatabase.go
+++ b/qt/gen_qfontdatabase.go
@@ -27,6 +27,9 @@ func (this *QFontDatabase) cPointer() *C.QFontDatabase {
 }
 
 func newQFontDatabase(h *C.QFontDatabase) *QFontDatabase {
+	if h == nil {
+		return nil
+	}
 	return &QFontDatabase{h: h}
 }
 
diff --git a/qt/gen_qfontdialog.go b/qt/gen_qfontdialog.go
index 4d6e5f5b..b33918cb 100644
--- a/qt/gen_qfontdialog.go
+++ b/qt/gen_qfontdialog.go
@@ -29,6 +29,9 @@ func (this *QFontDialog) cPointer() *C.QFontDialog {
 }
 
 func newQFontDialog(h *C.QFontDialog) *QFontDialog {
+	if h == nil {
+		return nil
+	}
 	return &QFontDialog{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfontinfo.go b/qt/gen_qfontinfo.go
index 8e91bdcc..f24c01b1 100644
--- a/qt/gen_qfontinfo.go
+++ b/qt/gen_qfontinfo.go
@@ -26,6 +26,9 @@ func (this *QFontInfo) cPointer() *C.QFontInfo {
 }
 
 func newQFontInfo(h *C.QFontInfo) *QFontInfo {
+	if h == nil {
+		return nil
+	}
 	return &QFontInfo{h: h}
 }
 
diff --git a/qt/gen_qfontmetrics.go b/qt/gen_qfontmetrics.go
index 0f4aaa2f..a1142e5b 100644
--- a/qt/gen_qfontmetrics.go
+++ b/qt/gen_qfontmetrics.go
@@ -27,6 +27,9 @@ func (this *QFontMetrics) cPointer() *C.QFontMetrics {
 }
 
 func newQFontMetrics(h *C.QFontMetrics) *QFontMetrics {
+	if h == nil {
+		return nil
+	}
 	return &QFontMetrics{h: h}
 }
 
@@ -414,6 +417,9 @@ func (this *QFontMetricsF) cPointer() *C.QFontMetricsF {
 }
 
 func newQFontMetricsF(h *C.QFontMetricsF) *QFontMetricsF {
+	if h == nil {
+		return nil
+	}
 	return &QFontMetricsF{h: h}
 }
 
diff --git a/qt/gen_qformlayout.go b/qt/gen_qformlayout.go
index d8414d89..d39912d8 100644
--- a/qt/gen_qformlayout.go
+++ b/qt/gen_qformlayout.go
@@ -28,6 +28,9 @@ func (this *QFormLayout) cPointer() *C.QFormLayout {
 }
 
 func newQFormLayout(h *C.QFormLayout) *QFormLayout {
+	if h == nil {
+		return nil
+	}
 	return &QFormLayout{h: h, QLayout: newQLayout_U(unsafe.Pointer(h))}
 }
 
@@ -402,6 +405,9 @@ func (this *QFormLayout__TakeRowResult) cPointer() *C.QFormLayout__TakeRowResult
 }
 
 func newQFormLayout__TakeRowResult(h *C.QFormLayout__TakeRowResult) *QFormLayout__TakeRowResult {
+	if h == nil {
+		return nil
+	}
 	return &QFormLayout__TakeRowResult{h: h}
 }
 
diff --git a/qt/gen_qframe.go b/qt/gen_qframe.go
index abead5cf..a9e7b4bc 100644
--- a/qt/gen_qframe.go
+++ b/qt/gen_qframe.go
@@ -28,6 +28,9 @@ func (this *QFrame) cPointer() *C.QFrame {
 }
 
 func newQFrame(h *C.QFrame) *QFrame {
+	if h == nil {
+		return nil
+	}
 	return &QFrame{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qfutureinterface.go b/qt/gen_qfutureinterface.go
index c70a4c14..7fef4625 100644
--- a/qt/gen_qfutureinterface.go
+++ b/qt/gen_qfutureinterface.go
@@ -26,6 +26,9 @@ func (this *QFutureInterfaceBase) cPointer() *C.QFutureInterfaceBase {
 }
 
 func newQFutureInterfaceBase(h *C.QFutureInterfaceBase) *QFutureInterfaceBase {
+	if h == nil {
+		return nil
+	}
 	return &QFutureInterfaceBase{h: h}
 }
 
diff --git a/qt/gen_qfuturewatcher.go b/qt/gen_qfuturewatcher.go
index fe3a3607..4b57861e 100644
--- a/qt/gen_qfuturewatcher.go
+++ b/qt/gen_qfuturewatcher.go
@@ -28,6 +28,9 @@ func (this *QFutureWatcherBase) cPointer() *C.QFutureWatcherBase {
 }
 
 func newQFutureWatcherBase(h *C.QFutureWatcherBase) *QFutureWatcherBase {
+	if h == nil {
+		return nil
+	}
 	return &QFutureWatcherBase{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgenericplugin.go b/qt/gen_qgenericplugin.go
index 9066acf4..0575792f 100644
--- a/qt/gen_qgenericplugin.go
+++ b/qt/gen_qgenericplugin.go
@@ -27,6 +27,9 @@ func (this *QGenericPlugin) cPointer() *C.QGenericPlugin {
 }
 
 func newQGenericPlugin(h *C.QGenericPlugin) *QGenericPlugin {
+	if h == nil {
+		return nil
+	}
 	return &QGenericPlugin{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgenericpluginfactory.go b/qt/gen_qgenericpluginfactory.go
index 1e3ac10b..c223f93f 100644
--- a/qt/gen_qgenericpluginfactory.go
+++ b/qt/gen_qgenericpluginfactory.go
@@ -26,6 +26,9 @@ func (this *QGenericPluginFactory) cPointer() *C.QGenericPluginFactory {
 }
 
 func newQGenericPluginFactory(h *C.QGenericPluginFactory) *QGenericPluginFactory {
+	if h == nil {
+		return nil
+	}
 	return &QGenericPluginFactory{h: h}
 }
 
diff --git a/qt/gen_qgesture.go b/qt/gen_qgesture.go
index e673a7fb..5882209b 100644
--- a/qt/gen_qgesture.go
+++ b/qt/gen_qgesture.go
@@ -28,6 +28,9 @@ func (this *QGesture) cPointer() *C.QGesture {
 }
 
 func newQGesture(h *C.QGesture) *QGesture {
+	if h == nil {
+		return nil
+	}
 	return &QGesture{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -186,6 +189,9 @@ func (this *QPanGesture) cPointer() *C.QPanGesture {
 }
 
 func newQPanGesture(h *C.QPanGesture) *QPanGesture {
+	if h == nil {
+		return nil
+	}
 	return &QPanGesture{h: h, QGesture: newQGesture_U(unsafe.Pointer(h))}
 }
 
@@ -351,6 +357,9 @@ func (this *QPinchGesture) cPointer() *C.QPinchGesture {
 }
 
 func newQPinchGesture(h *C.QPinchGesture) *QPinchGesture {
+	if h == nil {
+		return nil
+	}
 	return &QPinchGesture{h: h, QGesture: newQGesture_U(unsafe.Pointer(h))}
 }
 
@@ -583,6 +592,9 @@ func (this *QSwipeGesture) cPointer() *C.QSwipeGesture {
 }
 
 func newQSwipeGesture(h *C.QSwipeGesture) *QSwipeGesture {
+	if h == nil {
+		return nil
+	}
 	return &QSwipeGesture{h: h, QGesture: newQGesture_U(unsafe.Pointer(h))}
 }
 
@@ -717,6 +729,9 @@ func (this *QTapGesture) cPointer() *C.QTapGesture {
 }
 
 func newQTapGesture(h *C.QTapGesture) *QTapGesture {
+	if h == nil {
+		return nil
+	}
 	return &QTapGesture{h: h, QGesture: newQGesture_U(unsafe.Pointer(h))}
 }
 
@@ -847,6 +862,9 @@ func (this *QTapAndHoldGesture) cPointer() *C.QTapAndHoldGesture {
 }
 
 func newQTapAndHoldGesture(h *C.QTapAndHoldGesture) *QTapAndHoldGesture {
+	if h == nil {
+		return nil
+	}
 	return &QTapAndHoldGesture{h: h, QGesture: newQGesture_U(unsafe.Pointer(h))}
 }
 
@@ -986,6 +1004,9 @@ func (this *QGestureEvent) cPointer() *C.QGestureEvent {
 }
 
 func newQGestureEvent(h *C.QGestureEvent) *QGestureEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGestureEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgesturerecognizer.go b/qt/gen_qgesturerecognizer.go
index 4462fd7a..418890ba 100644
--- a/qt/gen_qgesturerecognizer.go
+++ b/qt/gen_qgesturerecognizer.go
@@ -26,6 +26,9 @@ func (this *QGestureRecognizer) cPointer() *C.QGestureRecognizer {
 }
 
 func newQGestureRecognizer(h *C.QGestureRecognizer) *QGestureRecognizer {
+	if h == nil {
+		return nil
+	}
 	return &QGestureRecognizer{h: h}
 }
 
diff --git a/qt/gen_qglyphrun.go b/qt/gen_qglyphrun.go
index 76d9f52f..b1f74264 100644
--- a/qt/gen_qglyphrun.go
+++ b/qt/gen_qglyphrun.go
@@ -27,6 +27,9 @@ func (this *QGlyphRun) cPointer() *C.QGlyphRun {
 }
 
 func newQGlyphRun(h *C.QGlyphRun) *QGlyphRun {
+	if h == nil {
+		return nil
+	}
 	return &QGlyphRun{h: h}
 }
 
diff --git a/qt/gen_qgraphicsanchorlayout.go b/qt/gen_qgraphicsanchorlayout.go
index 1ecf6ec4..81a93586 100644
--- a/qt/gen_qgraphicsanchorlayout.go
+++ b/qt/gen_qgraphicsanchorlayout.go
@@ -27,6 +27,9 @@ func (this *QGraphicsAnchor) cPointer() *C.QGraphicsAnchor {
 }
 
 func newQGraphicsAnchor(h *C.QGraphicsAnchor) *QGraphicsAnchor {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsAnchor{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -152,6 +155,9 @@ func (this *QGraphicsAnchorLayout) cPointer() *C.QGraphicsAnchorLayout {
 }
 
 func newQGraphicsAnchorLayout(h *C.QGraphicsAnchorLayout) *QGraphicsAnchorLayout {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsAnchorLayout{h: h, QGraphicsLayout: newQGraphicsLayout_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicseffect.go b/qt/gen_qgraphicseffect.go
index 6c981b0c..c5b82175 100644
--- a/qt/gen_qgraphicseffect.go
+++ b/qt/gen_qgraphicseffect.go
@@ -29,6 +29,9 @@ func (this *QGraphicsEffect) cPointer() *C.QGraphicsEffect {
 }
 
 func newQGraphicsEffect(h *C.QGraphicsEffect) *QGraphicsEffect {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsEffect{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -179,6 +182,9 @@ func (this *QGraphicsColorizeEffect) cPointer() *C.QGraphicsColorizeEffect {
 }
 
 func newQGraphicsColorizeEffect(h *C.QGraphicsColorizeEffect) *QGraphicsColorizeEffect {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsColorizeEffect{h: h, QGraphicsEffect: newQGraphicsEffect_U(unsafe.Pointer(h))}
 }
 
@@ -342,6 +348,9 @@ func (this *QGraphicsBlurEffect) cPointer() *C.QGraphicsBlurEffect {
 }
 
 func newQGraphicsBlurEffect(h *C.QGraphicsBlurEffect) *QGraphicsBlurEffect {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsBlurEffect{h: h, QGraphicsEffect: newQGraphicsEffect_U(unsafe.Pointer(h))}
 }
 
@@ -510,6 +519,9 @@ func (this *QGraphicsDropShadowEffect) cPointer() *C.QGraphicsDropShadowEffect {
 }
 
 func newQGraphicsDropShadowEffect(h *C.QGraphicsDropShadowEffect) *QGraphicsDropShadowEffect {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsDropShadowEffect{h: h, QGraphicsEffect: newQGraphicsEffect_U(unsafe.Pointer(h))}
 }
 
@@ -737,6 +749,9 @@ func (this *QGraphicsOpacityEffect) cPointer() *C.QGraphicsOpacityEffect {
 }
 
 func newQGraphicsOpacityEffect(h *C.QGraphicsOpacityEffect) *QGraphicsOpacityEffect {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsOpacityEffect{h: h, QGraphicsEffect: newQGraphicsEffect_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicsgridlayout.go b/qt/gen_qgraphicsgridlayout.go
index 58d9eba0..f5eb37cb 100644
--- a/qt/gen_qgraphicsgridlayout.go
+++ b/qt/gen_qgraphicsgridlayout.go
@@ -28,6 +28,9 @@ func (this *QGraphicsGridLayout) cPointer() *C.QGraphicsGridLayout {
 }
 
 func newQGraphicsGridLayout(h *C.QGraphicsGridLayout) *QGraphicsGridLayout {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsGridLayout{h: h, QGraphicsLayout: newQGraphicsLayout_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicsitem.go b/qt/gen_qgraphicsitem.go
index 6d7d8991..d92b91ab 100644
--- a/qt/gen_qgraphicsitem.go
+++ b/qt/gen_qgraphicsitem.go
@@ -28,6 +28,9 @@ func (this *QGraphicsItem) cPointer() *C.QGraphicsItem {
 }
 
 func newQGraphicsItem(h *C.QGraphicsItem) *QGraphicsItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsItem{h: h}
 }
 
@@ -1235,6 +1238,9 @@ func (this *QGraphicsObject) cPointer() *C.QGraphicsObject {
 }
 
 func newQGraphicsObject(h *C.QGraphicsObject) *QGraphicsObject {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsObject{h: h, QObject: newQObject_U(unsafe.Pointer(h)), QGraphicsItem: newQGraphicsItem_U(unsafe.Pointer(h))}
 }
 
@@ -1494,6 +1500,9 @@ func (this *QAbstractGraphicsShapeItem) cPointer() *C.QAbstractGraphicsShapeItem
 }
 
 func newQAbstractGraphicsShapeItem(h *C.QAbstractGraphicsShapeItem) *QAbstractGraphicsShapeItem {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractGraphicsShapeItem{h: h, QGraphicsItem: newQGraphicsItem_U(unsafe.Pointer(h))}
 }
 
@@ -1564,6 +1573,9 @@ func (this *QGraphicsPathItem) cPointer() *C.QGraphicsPathItem {
 }
 
 func newQGraphicsPathItem(h *C.QGraphicsPathItem) *QGraphicsPathItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsPathItem{h: h, QAbstractGraphicsShapeItem: newQAbstractGraphicsShapeItem_U(unsafe.Pointer(h))}
 }
 
@@ -1683,6 +1695,9 @@ func (this *QGraphicsRectItem) cPointer() *C.QGraphicsRectItem {
 }
 
 func newQGraphicsRectItem(h *C.QGraphicsRectItem) *QGraphicsRectItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsRectItem{h: h, QAbstractGraphicsShapeItem: newQAbstractGraphicsShapeItem_U(unsafe.Pointer(h))}
 }
 
@@ -1818,6 +1833,9 @@ func (this *QGraphicsEllipseItem) cPointer() *C.QGraphicsEllipseItem {
 }
 
 func newQGraphicsEllipseItem(h *C.QGraphicsEllipseItem) *QGraphicsEllipseItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsEllipseItem{h: h, QAbstractGraphicsShapeItem: newQAbstractGraphicsShapeItem_U(unsafe.Pointer(h))}
 }
 
@@ -1971,6 +1989,9 @@ func (this *QGraphicsPolygonItem) cPointer() *C.QGraphicsPolygonItem {
 }
 
 func newQGraphicsPolygonItem(h *C.QGraphicsPolygonItem) *QGraphicsPolygonItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsPolygonItem{h: h, QAbstractGraphicsShapeItem: newQAbstractGraphicsShapeItem_U(unsafe.Pointer(h))}
 }
 
@@ -2072,6 +2093,9 @@ func (this *QGraphicsLineItem) cPointer() *C.QGraphicsLineItem {
 }
 
 func newQGraphicsLineItem(h *C.QGraphicsLineItem) *QGraphicsLineItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsLineItem{h: h, QGraphicsItem: newQGraphicsItem_U(unsafe.Pointer(h))}
 }
 
@@ -2222,6 +2246,9 @@ func (this *QGraphicsPixmapItem) cPointer() *C.QGraphicsPixmapItem {
 }
 
 func newQGraphicsPixmapItem(h *C.QGraphicsPixmapItem) *QGraphicsPixmapItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsPixmapItem{h: h, QGraphicsItem: newQGraphicsItem_U(unsafe.Pointer(h))}
 }
 
@@ -2374,6 +2401,9 @@ func (this *QGraphicsTextItem) cPointer() *C.QGraphicsTextItem {
 }
 
 func newQGraphicsTextItem(h *C.QGraphicsTextItem) *QGraphicsTextItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsTextItem{h: h, QGraphicsObject: newQGraphicsObject_U(unsafe.Pointer(h))}
 }
 
@@ -2709,6 +2739,9 @@ func (this *QGraphicsSimpleTextItem) cPointer() *C.QGraphicsSimpleTextItem {
 }
 
 func newQGraphicsSimpleTextItem(h *C.QGraphicsSimpleTextItem) *QGraphicsSimpleTextItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSimpleTextItem{h: h, QAbstractGraphicsShapeItem: newQAbstractGraphicsShapeItem_U(unsafe.Pointer(h))}
 }
 
@@ -2843,6 +2876,9 @@ func (this *QGraphicsItemGroup) cPointer() *C.QGraphicsItemGroup {
 }
 
 func newQGraphicsItemGroup(h *C.QGraphicsItemGroup) *QGraphicsItemGroup {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsItemGroup{h: h, QGraphicsItem: newQGraphicsItem_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicsitemanimation.go b/qt/gen_qgraphicsitemanimation.go
index bfa71d86..2f6eb661 100644
--- a/qt/gen_qgraphicsitemanimation.go
+++ b/qt/gen_qgraphicsitemanimation.go
@@ -28,6 +28,9 @@ func (this *QGraphicsItemAnimation) cPointer() *C.QGraphicsItemAnimation {
 }
 
 func newQGraphicsItemAnimation(h *C.QGraphicsItemAnimation) *QGraphicsItemAnimation {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsItemAnimation{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicslayout.go b/qt/gen_qgraphicslayout.go
index 477abbb6..77b1949a 100644
--- a/qt/gen_qgraphicslayout.go
+++ b/qt/gen_qgraphicslayout.go
@@ -27,6 +27,9 @@ func (this *QGraphicsLayout) cPointer() *C.QGraphicsLayout {
 }
 
 func newQGraphicsLayout(h *C.QGraphicsLayout) *QGraphicsLayout {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsLayout{h: h, QGraphicsLayoutItem: newQGraphicsLayoutItem_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicslayoutitem.go b/qt/gen_qgraphicslayoutitem.go
index 314b05bc..6dbb4175 100644
--- a/qt/gen_qgraphicslayoutitem.go
+++ b/qt/gen_qgraphicslayoutitem.go
@@ -27,6 +27,9 @@ func (this *QGraphicsLayoutItem) cPointer() *C.QGraphicsLayoutItem {
 }
 
 func newQGraphicsLayoutItem(h *C.QGraphicsLayoutItem) *QGraphicsLayoutItem {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsLayoutItem{h: h}
 }
 
diff --git a/qt/gen_qgraphicslinearlayout.go b/qt/gen_qgraphicslinearlayout.go
index 2a00d7aa..3e8cdb6e 100644
--- a/qt/gen_qgraphicslinearlayout.go
+++ b/qt/gen_qgraphicslinearlayout.go
@@ -28,6 +28,9 @@ func (this *QGraphicsLinearLayout) cPointer() *C.QGraphicsLinearLayout {
 }
 
 func newQGraphicsLinearLayout(h *C.QGraphicsLinearLayout) *QGraphicsLinearLayout {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsLinearLayout{h: h, QGraphicsLayout: newQGraphicsLayout_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicsproxywidget.go b/qt/gen_qgraphicsproxywidget.go
index a6bc277c..ff138ad4 100644
--- a/qt/gen_qgraphicsproxywidget.go
+++ b/qt/gen_qgraphicsproxywidget.go
@@ -28,6 +28,9 @@ func (this *QGraphicsProxyWidget) cPointer() *C.QGraphicsProxyWidget {
 }
 
 func newQGraphicsProxyWidget(h *C.QGraphicsProxyWidget) *QGraphicsProxyWidget {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsProxyWidget{h: h, QGraphicsWidget: newQGraphicsWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicsscene.go b/qt/gen_qgraphicsscene.go
index 773fb8fc..5681bed2 100644
--- a/qt/gen_qgraphicsscene.go
+++ b/qt/gen_qgraphicsscene.go
@@ -29,6 +29,9 @@ func (this *QGraphicsScene) cPointer() *C.QGraphicsScene {
 }
 
 func newQGraphicsScene(h *C.QGraphicsScene) *QGraphicsScene {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsScene{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicssceneevent.go b/qt/gen_qgraphicssceneevent.go
index 980f07fa..5ccbb886 100644
--- a/qt/gen_qgraphicssceneevent.go
+++ b/qt/gen_qgraphicssceneevent.go
@@ -28,6 +28,9 @@ func (this *QGraphicsSceneEvent) cPointer() *C.QGraphicsSceneEvent {
 }
 
 func newQGraphicsSceneEvent(h *C.QGraphicsSceneEvent) *QGraphicsSceneEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -67,6 +70,9 @@ func (this *QGraphicsSceneMouseEvent) cPointer() *C.QGraphicsSceneMouseEvent {
 }
 
 func newQGraphicsSceneMouseEvent(h *C.QGraphicsSceneMouseEvent) *QGraphicsSceneMouseEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneMouseEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
@@ -283,6 +289,9 @@ func (this *QGraphicsSceneWheelEvent) cPointer() *C.QGraphicsSceneWheelEvent {
 }
 
 func newQGraphicsSceneWheelEvent(h *C.QGraphicsSceneWheelEvent) *QGraphicsSceneWheelEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneWheelEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
@@ -400,6 +409,9 @@ func (this *QGraphicsSceneContextMenuEvent) cPointer() *C.QGraphicsSceneContextM
 }
 
 func newQGraphicsSceneContextMenuEvent(h *C.QGraphicsSceneContextMenuEvent) *QGraphicsSceneContextMenuEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneContextMenuEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
@@ -499,6 +511,9 @@ func (this *QGraphicsSceneHoverEvent) cPointer() *C.QGraphicsSceneHoverEvent {
 }
 
 func newQGraphicsSceneHoverEvent(h *C.QGraphicsSceneHoverEvent) *QGraphicsSceneHoverEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneHoverEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
@@ -634,6 +649,9 @@ func (this *QGraphicsSceneHelpEvent) cPointer() *C.QGraphicsSceneHelpEvent {
 }
 
 func newQGraphicsSceneHelpEvent(h *C.QGraphicsSceneHelpEvent) *QGraphicsSceneHelpEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneHelpEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
@@ -700,6 +718,9 @@ func (this *QGraphicsSceneDragDropEvent) cPointer() *C.QGraphicsSceneDragDropEve
 }
 
 func newQGraphicsSceneDragDropEvent(h *C.QGraphicsSceneDragDropEvent) *QGraphicsSceneDragDropEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneDragDropEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
@@ -848,6 +869,9 @@ func (this *QGraphicsSceneResizeEvent) cPointer() *C.QGraphicsSceneResizeEvent {
 }
 
 func newQGraphicsSceneResizeEvent(h *C.QGraphicsSceneResizeEvent) *QGraphicsSceneResizeEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneResizeEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
@@ -908,6 +932,9 @@ func (this *QGraphicsSceneMoveEvent) cPointer() *C.QGraphicsSceneMoveEvent {
 }
 
 func newQGraphicsSceneMoveEvent(h *C.QGraphicsSceneMoveEvent) *QGraphicsSceneMoveEvent {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsSceneMoveEvent{h: h, QGraphicsSceneEvent: newQGraphicsSceneEvent_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicstransform.go b/qt/gen_qgraphicstransform.go
index 6f8f4699..d5ad53d5 100644
--- a/qt/gen_qgraphicstransform.go
+++ b/qt/gen_qgraphicstransform.go
@@ -29,6 +29,9 @@ func (this *QGraphicsTransform) cPointer() *C.QGraphicsTransform {
 }
 
 func newQGraphicsTransform(h *C.QGraphicsTransform) *QGraphicsTransform {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsTransform{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -136,6 +139,9 @@ func (this *QGraphicsScale) cPointer() *C.QGraphicsScale {
 }
 
 func newQGraphicsScale(h *C.QGraphicsScale) *QGraphicsScale {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsScale{h: h, QGraphicsTransform: newQGraphicsTransform_U(unsafe.Pointer(h))}
 }
 
@@ -357,6 +363,9 @@ func (this *QGraphicsRotation) cPointer() *C.QGraphicsRotation {
 }
 
 func newQGraphicsRotation(h *C.QGraphicsRotation) *QGraphicsRotation {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsRotation{h: h, QGraphicsTransform: newQGraphicsTransform_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicsview.go b/qt/gen_qgraphicsview.go
index 5e4e660b..2cede632 100644
--- a/qt/gen_qgraphicsview.go
+++ b/qt/gen_qgraphicsview.go
@@ -29,6 +29,9 @@ func (this *QGraphicsView) cPointer() *C.QGraphicsView {
 }
 
 func newQGraphicsView(h *C.QGraphicsView) *QGraphicsView {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsView{h: h, QAbstractScrollArea: newQAbstractScrollArea_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgraphicswidget.go b/qt/gen_qgraphicswidget.go
index 8aedf7ff..1380b874 100644
--- a/qt/gen_qgraphicswidget.go
+++ b/qt/gen_qgraphicswidget.go
@@ -30,6 +30,9 @@ func (this *QGraphicsWidget) cPointer() *C.QGraphicsWidget {
 }
 
 func newQGraphicsWidget(h *C.QGraphicsWidget) *QGraphicsWidget {
+	if h == nil {
+		return nil
+	}
 	return &QGraphicsWidget{h: h, QGraphicsObject: newQGraphicsObject_U(unsafe.Pointer(h)), QGraphicsLayoutItem: newQGraphicsLayoutItem_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgridlayout.go b/qt/gen_qgridlayout.go
index 8808f92c..10fc0709 100644
--- a/qt/gen_qgridlayout.go
+++ b/qt/gen_qgridlayout.go
@@ -28,6 +28,9 @@ func (this *QGridLayout) cPointer() *C.QGridLayout {
 }
 
 func newQGridLayout(h *C.QGridLayout) *QGridLayout {
+	if h == nil {
+		return nil
+	}
 	return &QGridLayout{h: h, QLayout: newQLayout_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qgroupbox.go b/qt/gen_qgroupbox.go
index de587d5e..ffab33d9 100644
--- a/qt/gen_qgroupbox.go
+++ b/qt/gen_qgroupbox.go
@@ -29,6 +29,9 @@ func (this *QGroupBox) cPointer() *C.QGroupBox {
 }
 
 func newQGroupBox(h *C.QGroupBox) *QGroupBox {
+	if h == nil {
+		return nil
+	}
 	return &QGroupBox{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qguiapplication.go b/qt/gen_qguiapplication.go
index 10a17ed6..9a84d7e5 100644
--- a/qt/gen_qguiapplication.go
+++ b/qt/gen_qguiapplication.go
@@ -29,6 +29,9 @@ func (this *QGuiApplication) cPointer() *C.QGuiApplication {
 }
 
 func newQGuiApplication(h *C.QGuiApplication) *QGuiApplication {
+	if h == nil {
+		return nil
+	}
 	return &QGuiApplication{h: h, QCoreApplication: newQCoreApplication_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qhash.go b/qt/gen_qhash.go
index c4108847..9a3208d3 100644
--- a/qt/gen_qhash.go
+++ b/qt/gen_qhash.go
@@ -26,6 +26,9 @@ func (this *QHashData) cPointer() *C.QHashData {
 }
 
 func newQHashData(h *C.QHashData) *QHashData {
+	if h == nil {
+		return nil
+	}
 	return &QHashData{h: h}
 }
 
@@ -77,6 +80,9 @@ func (this *QHashDummyValue) cPointer() *C.QHashDummyValue {
 }
 
 func newQHashDummyValue(h *C.QHashDummyValue) *QHashDummyValue {
+	if h == nil {
+		return nil
+	}
 	return &QHashDummyValue{h: h}
 }
 
@@ -112,6 +118,9 @@ func (this *QHashData__Node) cPointer() *C.QHashData__Node {
 }
 
 func newQHashData__Node(h *C.QHashData__Node) *QHashData__Node {
+	if h == nil {
+		return nil
+	}
 	return &QHashData__Node{h: h}
 }
 
diff --git a/qt/gen_qhashfunctions.go b/qt/gen_qhashfunctions.go
index 7ef913fc..f3f35da0 100644
--- a/qt/gen_qhashfunctions.go
+++ b/qt/gen_qhashfunctions.go
@@ -26,6 +26,9 @@ func (this *QtPrivate__QHashCombine) cPointer() *C.QtPrivate__QHashCombine {
 }
 
 func newQtPrivate__QHashCombine(h *C.QtPrivate__QHashCombine) *QtPrivate__QHashCombine {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__QHashCombine{h: h}
 }
 
@@ -61,6 +64,9 @@ func (this *QtPrivate__QHashCombineCommutative) cPointer() *C.QtPrivate__QHashCo
 }
 
 func newQtPrivate__QHashCombineCommutative(h *C.QtPrivate__QHashCombineCommutative) *QtPrivate__QHashCombineCommutative {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__QHashCombineCommutative{h: h}
 }
 
diff --git a/qt/gen_qheaderview.go b/qt/gen_qheaderview.go
index 32a478ec..f2d7e0da 100644
--- a/qt/gen_qheaderview.go
+++ b/qt/gen_qheaderview.go
@@ -29,6 +29,9 @@ func (this *QHeaderView) cPointer() *C.QHeaderView {
 }
 
 func newQHeaderView(h *C.QHeaderView) *QHeaderView {
+	if h == nil {
+		return nil
+	}
 	return &QHeaderView{h: h, QAbstractItemView: newQAbstractItemView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qhistorystate.go b/qt/gen_qhistorystate.go
index c3023908..d15c27f6 100644
--- a/qt/gen_qhistorystate.go
+++ b/qt/gen_qhistorystate.go
@@ -27,6 +27,9 @@ func (this *QHistoryState) cPointer() *C.QHistoryState {
 }
 
 func newQHistoryState(h *C.QHistoryState) *QHistoryState {
+	if h == nil {
+		return nil
+	}
 	return &QHistoryState{h: h, QAbstractState: newQAbstractState_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qicon.go b/qt/gen_qicon.go
index 4aeb6546..95db5463 100644
--- a/qt/gen_qicon.go
+++ b/qt/gen_qicon.go
@@ -27,6 +27,9 @@ func (this *QIcon) cPointer() *C.QIcon {
 }
 
 func newQIcon(h *C.QIcon) *QIcon {
+	if h == nil {
+		return nil
+	}
 	return &QIcon{h: h}
 }
 
diff --git a/qt/gen_qiconengine.go b/qt/gen_qiconengine.go
index 44ed48b5..c1ac2255 100644
--- a/qt/gen_qiconengine.go
+++ b/qt/gen_qiconengine.go
@@ -27,6 +27,9 @@ func (this *QIconEngine) cPointer() *C.QIconEngine {
 }
 
 func newQIconEngine(h *C.QIconEngine) *QIconEngine {
+	if h == nil {
+		return nil
+	}
 	return &QIconEngine{h: h}
 }
 
@@ -174,6 +177,9 @@ func (this *QIconEngine__AvailableSizesArgument) cPointer() *C.QIconEngine__Avai
 }
 
 func newQIconEngine__AvailableSizesArgument(h *C.QIconEngine__AvailableSizesArgument) *QIconEngine__AvailableSizesArgument {
+	if h == nil {
+		return nil
+	}
 	return &QIconEngine__AvailableSizesArgument{h: h}
 }
 
@@ -203,6 +209,9 @@ func (this *QIconEngine__ScaledPixmapArgument) cPointer() *C.QIconEngine__Scaled
 }
 
 func newQIconEngine__ScaledPixmapArgument(h *C.QIconEngine__ScaledPixmapArgument) *QIconEngine__ScaledPixmapArgument {
+	if h == nil {
+		return nil
+	}
 	return &QIconEngine__ScaledPixmapArgument{h: h}
 }
 
diff --git a/qt/gen_qiconengineplugin.go b/qt/gen_qiconengineplugin.go
index 792db6f4..16350014 100644
--- a/qt/gen_qiconengineplugin.go
+++ b/qt/gen_qiconengineplugin.go
@@ -27,6 +27,9 @@ func (this *QIconEnginePlugin) cPointer() *C.QIconEnginePlugin {
 }
 
 func newQIconEnginePlugin(h *C.QIconEnginePlugin) *QIconEnginePlugin {
+	if h == nil {
+		return nil
+	}
 	return &QIconEnginePlugin{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qidentityproxymodel.go b/qt/gen_qidentityproxymodel.go
index 3a8ac65f..4d9a533f 100644
--- a/qt/gen_qidentityproxymodel.go
+++ b/qt/gen_qidentityproxymodel.go
@@ -28,6 +28,9 @@ func (this *QIdentityProxyModel) cPointer() *C.QIdentityProxyModel {
 }
 
 func newQIdentityProxyModel(h *C.QIdentityProxyModel) *QIdentityProxyModel {
+	if h == nil {
+		return nil
+	}
 	return &QIdentityProxyModel{h: h, QAbstractProxyModel: newQAbstractProxyModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qimage.go b/qt/gen_qimage.go
index 09fae136..8ce0ecc5 100644
--- a/qt/gen_qimage.go
+++ b/qt/gen_qimage.go
@@ -28,6 +28,9 @@ func (this *QImage) cPointer() *C.QImage {
 }
 
 func newQImage(h *C.QImage) *QImage {
+	if h == nil {
+		return nil
+	}
 	return &QImage{h: h, QPaintDevice: newQPaintDevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qimageiohandler.go b/qt/gen_qimageiohandler.go
index c411892c..5bac3df5 100644
--- a/qt/gen_qimageiohandler.go
+++ b/qt/gen_qimageiohandler.go
@@ -27,6 +27,9 @@ func (this *QImageIOHandler) cPointer() *C.QImageIOHandler {
 }
 
 func newQImageIOHandler(h *C.QImageIOHandler) *QImageIOHandler {
+	if h == nil {
+		return nil
+	}
 	return &QImageIOHandler{h: h}
 }
 
@@ -166,6 +169,9 @@ func (this *QImageIOPlugin) cPointer() *C.QImageIOPlugin {
 }
 
 func newQImageIOPlugin(h *C.QImageIOPlugin) *QImageIOPlugin {
+	if h == nil {
+		return nil
+	}
 	return &QImageIOPlugin{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qimagereader.go b/qt/gen_qimagereader.go
index 2d64b478..c7f67b23 100644
--- a/qt/gen_qimagereader.go
+++ b/qt/gen_qimagereader.go
@@ -27,6 +27,9 @@ func (this *QImageReader) cPointer() *C.QImageReader {
 }
 
 func newQImageReader(h *C.QImageReader) *QImageReader {
+	if h == nil {
+		return nil
+	}
 	return &QImageReader{h: h}
 }
 
diff --git a/qt/gen_qimagewriter.go b/qt/gen_qimagewriter.go
index 3171dd4c..03d114e7 100644
--- a/qt/gen_qimagewriter.go
+++ b/qt/gen_qimagewriter.go
@@ -27,6 +27,9 @@ func (this *QImageWriter) cPointer() *C.QImageWriter {
 }
 
 func newQImageWriter(h *C.QImageWriter) *QImageWriter {
+	if h == nil {
+		return nil
+	}
 	return &QImageWriter{h: h}
 }
 
diff --git a/qt/gen_qinputdialog.go b/qt/gen_qinputdialog.go
index 2773867e..3c6054ee 100644
--- a/qt/gen_qinputdialog.go
+++ b/qt/gen_qinputdialog.go
@@ -29,6 +29,9 @@ func (this *QInputDialog) cPointer() *C.QInputDialog {
 }
 
 func newQInputDialog(h *C.QInputDialog) *QInputDialog {
+	if h == nil {
+		return nil
+	}
 	return &QInputDialog{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qinputmethod.go b/qt/gen_qinputmethod.go
index 9373a37a..1748f8ee 100644
--- a/qt/gen_qinputmethod.go
+++ b/qt/gen_qinputmethod.go
@@ -29,6 +29,9 @@ func (this *QInputMethod) cPointer() *C.QInputMethod {
 }
 
 func newQInputMethod(h *C.QInputMethod) *QInputMethod {
+	if h == nil {
+		return nil
+	}
 	return &QInputMethod{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qiodevice.go b/qt/gen_qiodevice.go
index 3de99c30..f1a8d77a 100644
--- a/qt/gen_qiodevice.go
+++ b/qt/gen_qiodevice.go
@@ -29,6 +29,9 @@ func (this *QIODevice) cPointer() *C.QIODevice {
 }
 
 func newQIODevice(h *C.QIODevice) *QIODevice {
+	if h == nil {
+		return nil
+	}
 	return &QIODevice{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qitemdelegate.go b/qt/gen_qitemdelegate.go
index 9aad35d9..2fe6deff 100644
--- a/qt/gen_qitemdelegate.go
+++ b/qt/gen_qitemdelegate.go
@@ -28,6 +28,9 @@ func (this *QItemDelegate) cPointer() *C.QItemDelegate {
 }
 
 func newQItemDelegate(h *C.QItemDelegate) *QItemDelegate {
+	if h == nil {
+		return nil
+	}
 	return &QItemDelegate{h: h, QAbstractItemDelegate: newQAbstractItemDelegate_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qitemeditorfactory.go b/qt/gen_qitemeditorfactory.go
index be9025b5..fc8d3965 100644
--- a/qt/gen_qitemeditorfactory.go
+++ b/qt/gen_qitemeditorfactory.go
@@ -27,6 +27,9 @@ func (this *QItemEditorCreatorBase) cPointer() *C.QItemEditorCreatorBase {
 }
 
 func newQItemEditorCreatorBase(h *C.QItemEditorCreatorBase) *QItemEditorCreatorBase {
+	if h == nil {
+		return nil
+	}
 	return &QItemEditorCreatorBase{h: h}
 }
 
@@ -70,6 +73,9 @@ func (this *QItemEditorFactory) cPointer() *C.QItemEditorFactory {
 }
 
 func newQItemEditorFactory(h *C.QItemEditorFactory) *QItemEditorFactory {
+	if h == nil {
+		return nil
+	}
 	return &QItemEditorFactory{h: h}
 }
 
diff --git a/qt/gen_qitemselectionmodel.go b/qt/gen_qitemselectionmodel.go
index 782cd9fa..c848b9d0 100644
--- a/qt/gen_qitemselectionmodel.go
+++ b/qt/gen_qitemselectionmodel.go
@@ -28,6 +28,9 @@ func (this *QItemSelectionRange) cPointer() *C.QItemSelectionRange {
 }
 
 func newQItemSelectionRange(h *C.QItemSelectionRange) *QItemSelectionRange {
+	if h == nil {
+		return nil
+	}
 	return &QItemSelectionRange{h: h}
 }
 
@@ -204,6 +207,9 @@ func (this *QItemSelectionModel) cPointer() *C.QItemSelectionModel {
 }
 
 func newQItemSelectionModel(h *C.QItemSelectionModel) *QItemSelectionModel {
+	if h == nil {
+		return nil
+	}
 	return &QItemSelectionModel{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qjsonarray.go b/qt/gen_qjsonarray.go
index 9485e624..2ab48cef 100644
--- a/qt/gen_qjsonarray.go
+++ b/qt/gen_qjsonarray.go
@@ -27,6 +27,9 @@ func (this *QJsonArray) cPointer() *C.QJsonArray {
 }
 
 func newQJsonArray(h *C.QJsonArray) *QJsonArray {
+	if h == nil {
+		return nil
+	}
 	return &QJsonArray{h: h}
 }
 
@@ -368,6 +371,9 @@ func (this *QJsonArray__iterator) cPointer() *C.QJsonArray__iterator {
 }
 
 func newQJsonArray__iterator(h *C.QJsonArray__iterator) *QJsonArray__iterator {
+	if h == nil {
+		return nil
+	}
 	return &QJsonArray__iterator{h: h}
 }
 
@@ -551,6 +557,9 @@ func (this *QJsonArray__const_iterator) cPointer() *C.QJsonArray__const_iterator
 }
 
 func newQJsonArray__const_iterator(h *C.QJsonArray__const_iterator) *QJsonArray__const_iterator {
+	if h == nil {
+		return nil
+	}
 	return &QJsonArray__const_iterator{h: h}
 }
 
diff --git a/qt/gen_qjsondocument.go b/qt/gen_qjsondocument.go
index c2625e75..4c35abb2 100644
--- a/qt/gen_qjsondocument.go
+++ b/qt/gen_qjsondocument.go
@@ -27,6 +27,9 @@ func (this *QJsonParseError) cPointer() *C.QJsonParseError {
 }
 
 func newQJsonParseError(h *C.QJsonParseError) *QJsonParseError {
+	if h == nil {
+		return nil
+	}
 	return &QJsonParseError{h: h}
 }
 
@@ -59,6 +62,9 @@ func (this *QJsonDocument) cPointer() *C.QJsonDocument {
 }
 
 func newQJsonDocument(h *C.QJsonDocument) *QJsonDocument {
+	if h == nil {
+		return nil
+	}
 	return &QJsonDocument{h: h}
 }
 
diff --git a/qt/gen_qjsonobject.go b/qt/gen_qjsonobject.go
index 093fa012..13d1b683 100644
--- a/qt/gen_qjsonobject.go
+++ b/qt/gen_qjsonobject.go
@@ -27,6 +27,9 @@ func (this *QJsonObject) cPointer() *C.QJsonObject {
 }
 
 func newQJsonObject(h *C.QJsonObject) *QJsonObject {
+	if h == nil {
+		return nil
+	}
 	return &QJsonObject{h: h}
 }
 
@@ -314,6 +317,9 @@ func (this *QJsonObject__iterator) cPointer() *C.QJsonObject__iterator {
 }
 
 func newQJsonObject__iterator(h *C.QJsonObject__iterator) *QJsonObject__iterator {
+	if h == nil {
+		return nil
+	}
 	return &QJsonObject__iterator{h: h}
 }
 
@@ -517,6 +523,9 @@ func (this *QJsonObject__const_iterator) cPointer() *C.QJsonObject__const_iterat
 }
 
 func newQJsonObject__const_iterator(h *C.QJsonObject__const_iterator) *QJsonObject__const_iterator {
+	if h == nil {
+		return nil
+	}
 	return &QJsonObject__const_iterator{h: h}
 }
 
diff --git a/qt/gen_qjsonvalue.go b/qt/gen_qjsonvalue.go
index 2aad3b05..41dd2d45 100644
--- a/qt/gen_qjsonvalue.go
+++ b/qt/gen_qjsonvalue.go
@@ -27,6 +27,9 @@ func (this *QJsonValue) cPointer() *C.QJsonValue {
 }
 
 func newQJsonValue(h *C.QJsonValue) *QJsonValue {
+	if h == nil {
+		return nil
+	}
 	return &QJsonValue{h: h}
 }
 
@@ -318,6 +321,9 @@ func (this *QJsonValueRef) cPointer() *C.QJsonValueRef {
 }
 
 func newQJsonValueRef(h *C.QJsonValueRef) *QJsonValueRef {
+	if h == nil {
+		return nil
+	}
 	return &QJsonValueRef{h: h}
 }
 
@@ -500,6 +506,9 @@ func (this *QJsonValuePtr) cPointer() *C.QJsonValuePtr {
 }
 
 func newQJsonValuePtr(h *C.QJsonValuePtr) *QJsonValuePtr {
+	if h == nil {
+		return nil
+	}
 	return &QJsonValuePtr{h: h}
 }
 
@@ -549,6 +558,9 @@ func (this *QJsonValueRefPtr) cPointer() *C.QJsonValueRefPtr {
 }
 
 func newQJsonValueRefPtr(h *C.QJsonValueRefPtr) *QJsonValueRefPtr {
+	if h == nil {
+		return nil
+	}
 	return &QJsonValueRefPtr{h: h}
 }
 
diff --git a/qt/gen_qkeyeventtransition.go b/qt/gen_qkeyeventtransition.go
index cc651a2e..fc22ec6b 100644
--- a/qt/gen_qkeyeventtransition.go
+++ b/qt/gen_qkeyeventtransition.go
@@ -27,6 +27,9 @@ func (this *QKeyEventTransition) cPointer() *C.QKeyEventTransition {
 }
 
 func newQKeyEventTransition(h *C.QKeyEventTransition) *QKeyEventTransition {
+	if h == nil {
+		return nil
+	}
 	return &QKeyEventTransition{h: h, QEventTransition: newQEventTransition_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qkeysequence.go b/qt/gen_qkeysequence.go
index e743b586..6add9bf8 100644
--- a/qt/gen_qkeysequence.go
+++ b/qt/gen_qkeysequence.go
@@ -27,6 +27,9 @@ func (this *QKeySequence) cPointer() *C.QKeySequence {
 }
 
 func newQKeySequence(h *C.QKeySequence) *QKeySequence {
+	if h == nil {
+		return nil
+	}
 	return &QKeySequence{h: h}
 }
 
diff --git a/qt/gen_qkeysequenceedit.go b/qt/gen_qkeysequenceedit.go
index 7a965e15..81ec8abd 100644
--- a/qt/gen_qkeysequenceedit.go
+++ b/qt/gen_qkeysequenceedit.go
@@ -29,6 +29,9 @@ func (this *QKeySequenceEdit) cPointer() *C.QKeySequenceEdit {
 }
 
 func newQKeySequenceEdit(h *C.QKeySequenceEdit) *QKeySequenceEdit {
+	if h == nil {
+		return nil
+	}
 	return &QKeySequenceEdit{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlabel.go b/qt/gen_qlabel.go
index 351c9902..8a7bf21c 100644
--- a/qt/gen_qlabel.go
+++ b/qt/gen_qlabel.go
@@ -29,6 +29,9 @@ func (this *QLabel) cPointer() *C.QLabel {
 }
 
 func newQLabel(h *C.QLabel) *QLabel {
+	if h == nil {
+		return nil
+	}
 	return &QLabel{h: h, QFrame: newQFrame_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlayout.go b/qt/gen_qlayout.go
index be2bd6bc..5cf4d8b4 100644
--- a/qt/gen_qlayout.go
+++ b/qt/gen_qlayout.go
@@ -29,6 +29,9 @@ func (this *QLayout) cPointer() *C.QLayout {
 }
 
 func newQLayout(h *C.QLayout) *QLayout {
+	if h == nil {
+		return nil
+	}
 	return &QLayout{h: h, QObject: newQObject_U(unsafe.Pointer(h)), QLayoutItem: newQLayoutItem_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlayoutitem.go b/qt/gen_qlayoutitem.go
index 8a8e850d..10a179ca 100644
--- a/qt/gen_qlayoutitem.go
+++ b/qt/gen_qlayoutitem.go
@@ -27,6 +27,9 @@ func (this *QLayoutItem) cPointer() *C.QLayoutItem {
 }
 
 func newQLayoutItem(h *C.QLayoutItem) *QLayoutItem {
+	if h == nil {
+		return nil
+	}
 	return &QLayoutItem{h: h}
 }
 
@@ -157,6 +160,9 @@ func (this *QSpacerItem) cPointer() *C.QSpacerItem {
 }
 
 func newQSpacerItem(h *C.QSpacerItem) *QSpacerItem {
+	if h == nil {
+		return nil
+	}
 	return &QSpacerItem{h: h, QLayoutItem: newQLayoutItem_U(unsafe.Pointer(h))}
 }
 
@@ -291,6 +297,9 @@ func (this *QWidgetItem) cPointer() *C.QWidgetItem {
 }
 
 func newQWidgetItem(h *C.QWidgetItem) *QWidgetItem {
+	if h == nil {
+		return nil
+	}
 	return &QWidgetItem{h: h, QLayoutItem: newQLayoutItem_U(unsafe.Pointer(h))}
 }
 
@@ -399,6 +408,9 @@ func (this *QWidgetItemV2) cPointer() *C.QWidgetItemV2 {
 }
 
 func newQWidgetItemV2(h *C.QWidgetItemV2) *QWidgetItemV2 {
+	if h == nil {
+		return nil
+	}
 	return &QWidgetItemV2{h: h, QWidgetItem: newQWidgetItem_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlcdnumber.go b/qt/gen_qlcdnumber.go
index aa1b4fb6..fcdccdfd 100644
--- a/qt/gen_qlcdnumber.go
+++ b/qt/gen_qlcdnumber.go
@@ -29,6 +29,9 @@ func (this *QLCDNumber) cPointer() *C.QLCDNumber {
 }
 
 func newQLCDNumber(h *C.QLCDNumber) *QLCDNumber {
+	if h == nil {
+		return nil
+	}
 	return &QLCDNumber{h: h, QFrame: newQFrame_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlibrary.go b/qt/gen_qlibrary.go
index cca755e8..1ef87e86 100644
--- a/qt/gen_qlibrary.go
+++ b/qt/gen_qlibrary.go
@@ -27,6 +27,9 @@ func (this *QLibrary) cPointer() *C.QLibrary {
 }
 
 func newQLibrary(h *C.QLibrary) *QLibrary {
+	if h == nil {
+		return nil
+	}
 	return &QLibrary{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlibraryinfo.go b/qt/gen_qlibraryinfo.go
index 1bfc8fa4..3d18907b 100644
--- a/qt/gen_qlibraryinfo.go
+++ b/qt/gen_qlibraryinfo.go
@@ -27,6 +27,9 @@ func (this *QLibraryInfo) cPointer() *C.QLibraryInfo {
 }
 
 func newQLibraryInfo(h *C.QLibraryInfo) *QLibraryInfo {
+	if h == nil {
+		return nil
+	}
 	return &QLibraryInfo{h: h}
 }
 
diff --git a/qt/gen_qline.go b/qt/gen_qline.go
index 1876a67a..8f8bd212 100644
--- a/qt/gen_qline.go
+++ b/qt/gen_qline.go
@@ -27,6 +27,9 @@ func (this *QLine) cPointer() *C.QLine {
 }
 
 func newQLine(h *C.QLine) *QLine {
+	if h == nil {
+		return nil
+	}
 	return &QLine{h: h}
 }
 
@@ -198,6 +201,9 @@ func (this *QLineF) cPointer() *C.QLineF {
 }
 
 func newQLineF(h *C.QLineF) *QLineF {
+	if h == nil {
+		return nil
+	}
 	return &QLineF{h: h}
 }
 
diff --git a/qt/gen_qlineedit.go b/qt/gen_qlineedit.go
index eb7f3512..81e86d7d 100644
--- a/qt/gen_qlineedit.go
+++ b/qt/gen_qlineedit.go
@@ -29,6 +29,9 @@ func (this *QLineEdit) cPointer() *C.QLineEdit {
 }
 
 func newQLineEdit(h *C.QLineEdit) *QLineEdit {
+	if h == nil {
+		return nil
+	}
 	return &QLineEdit{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlinkedlist.go b/qt/gen_qlinkedlist.go
index 0a59e687..2f9abf11 100644
--- a/qt/gen_qlinkedlist.go
+++ b/qt/gen_qlinkedlist.go
@@ -26,6 +26,9 @@ func (this *QLinkedListData) cPointer() *C.QLinkedListData {
 }
 
 func newQLinkedListData(h *C.QLinkedListData) *QLinkedListData {
+	if h == nil {
+		return nil
+	}
 	return &QLinkedListData{h: h}
 }
 
diff --git a/qt/gen_qlistview.go b/qt/gen_qlistview.go
index f2422435..3abc9210 100644
--- a/qt/gen_qlistview.go
+++ b/qt/gen_qlistview.go
@@ -29,6 +29,9 @@ func (this *QListView) cPointer() *C.QListView {
 }
 
 func newQListView(h *C.QListView) *QListView {
+	if h == nil {
+		return nil
+	}
 	return &QListView{h: h, QAbstractItemView: newQAbstractItemView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlistwidget.go b/qt/gen_qlistwidget.go
index 45b4567f..9365d3fc 100644
--- a/qt/gen_qlistwidget.go
+++ b/qt/gen_qlistwidget.go
@@ -28,6 +28,9 @@ func (this *QListWidgetItem) cPointer() *C.QListWidgetItem {
 }
 
 func newQListWidgetItem(h *C.QListWidgetItem) *QListWidgetItem {
+	if h == nil {
+		return nil
+	}
 	return &QListWidgetItem{h: h}
 }
 
@@ -381,6 +384,9 @@ func (this *QListWidget) cPointer() *C.QListWidget {
 }
 
 func newQListWidget(h *C.QListWidget) *QListWidget {
+	if h == nil {
+		return nil
+	}
 	return &QListWidget{h: h, QListView: newQListView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qlocale.go b/qt/gen_qlocale.go
index 7b4c98de..cd0f0e77 100644
--- a/qt/gen_qlocale.go
+++ b/qt/gen_qlocale.go
@@ -27,6 +27,9 @@ func (this *QLocale) cPointer() *C.QLocale {
 }
 
 func newQLocale(h *C.QLocale) *QLocale {
+	if h == nil {
+		return nil
+	}
 	return &QLocale{h: h}
 }
 
diff --git a/qt/gen_qlockfile.go b/qt/gen_qlockfile.go
index 303f09fd..a86f6b8b 100644
--- a/qt/gen_qlockfile.go
+++ b/qt/gen_qlockfile.go
@@ -26,6 +26,9 @@ func (this *QLockFile) cPointer() *C.QLockFile {
 }
 
 func newQLockFile(h *C.QLockFile) *QLockFile {
+	if h == nil {
+		return nil
+	}
 	return &QLockFile{h: h}
 }
 
diff --git a/qt/gen_qloggingcategory.go b/qt/gen_qloggingcategory.go
index 84d70874..fe323044 100644
--- a/qt/gen_qloggingcategory.go
+++ b/qt/gen_qloggingcategory.go
@@ -26,6 +26,9 @@ func (this *QLoggingCategory) cPointer() *C.QLoggingCategory {
 }
 
 func newQLoggingCategory(h *C.QLoggingCategory) *QLoggingCategory {
+	if h == nil {
+		return nil
+	}
 	return &QLoggingCategory{h: h}
 }
 
diff --git a/qt/gen_qmainwindow.go b/qt/gen_qmainwindow.go
index 02db0ca7..1c94717d 100644
--- a/qt/gen_qmainwindow.go
+++ b/qt/gen_qmainwindow.go
@@ -29,6 +29,9 @@ func (this *QMainWindow) cPointer() *C.QMainWindow {
 }
 
 func newQMainWindow(h *C.QMainWindow) *QMainWindow {
+	if h == nil {
+		return nil
+	}
 	return &QMainWindow{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmap.go b/qt/gen_qmap.go
index 1fad9bd3..c98ad062 100644
--- a/qt/gen_qmap.go
+++ b/qt/gen_qmap.go
@@ -26,6 +26,9 @@ func (this *QMapNodeBase) cPointer() *C.QMapNodeBase {
 }
 
 func newQMapNodeBase(h *C.QMapNodeBase) *QMapNodeBase {
+	if h == nil {
+		return nil
+	}
 	return &QMapNodeBase{h: h}
 }
 
@@ -97,6 +100,9 @@ func (this *QMapDataBase) cPointer() *C.QMapDataBase {
 }
 
 func newQMapDataBase(h *C.QMapDataBase) *QMapDataBase {
+	if h == nil {
+		return nil
+	}
 	return &QMapDataBase{h: h}
 }
 
diff --git a/qt/gen_qmargins.go b/qt/gen_qmargins.go
index 365379bb..399577c3 100644
--- a/qt/gen_qmargins.go
+++ b/qt/gen_qmargins.go
@@ -27,6 +27,9 @@ func (this *QMargins) cPointer() *C.QMargins {
 }
 
 func newQMargins(h *C.QMargins) *QMargins {
+	if h == nil {
+		return nil
+	}
 	return &QMargins{h: h}
 }
 
@@ -149,6 +152,9 @@ func (this *QMarginsF) cPointer() *C.QMarginsF {
 }
 
 func newQMarginsF(h *C.QMarginsF) *QMarginsF {
+	if h == nil {
+		return nil
+	}
 	return &QMarginsF{h: h}
 }
 
diff --git a/qt/gen_qmatrix.go b/qt/gen_qmatrix.go
index 310526b3..bed356ad 100644
--- a/qt/gen_qmatrix.go
+++ b/qt/gen_qmatrix.go
@@ -27,6 +27,9 @@ func (this *QMatrix) cPointer() *C.QMatrix {
 }
 
 func newQMatrix(h *C.QMatrix) *QMatrix {
+	if h == nil {
+		return nil
+	}
 	return &QMatrix{h: h}
 }
 
diff --git a/qt/gen_qmatrix4x4.go b/qt/gen_qmatrix4x4.go
index 1bec6c93..8b6c5204 100644
--- a/qt/gen_qmatrix4x4.go
+++ b/qt/gen_qmatrix4x4.go
@@ -27,6 +27,9 @@ func (this *QMatrix4x4) cPointer() *C.QMatrix4x4 {
 }
 
 func newQMatrix4x4(h *C.QMatrix4x4) *QMatrix4x4 {
+	if h == nil {
+		return nil
+	}
 	return &QMatrix4x4{h: h}
 }
 
diff --git a/qt/gen_qmdiarea.go b/qt/gen_qmdiarea.go
index 2e08b62f..6c191a41 100644
--- a/qt/gen_qmdiarea.go
+++ b/qt/gen_qmdiarea.go
@@ -29,6 +29,9 @@ func (this *QMdiArea) cPointer() *C.QMdiArea {
 }
 
 func newQMdiArea(h *C.QMdiArea) *QMdiArea {
+	if h == nil {
+		return nil
+	}
 	return &QMdiArea{h: h, QAbstractScrollArea: newQAbstractScrollArea_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmdisubwindow.go b/qt/gen_qmdisubwindow.go
index 421a6366..993d5cd5 100644
--- a/qt/gen_qmdisubwindow.go
+++ b/qt/gen_qmdisubwindow.go
@@ -29,6 +29,9 @@ func (this *QMdiSubWindow) cPointer() *C.QMdiSubWindow {
 }
 
 func newQMdiSubWindow(h *C.QMdiSubWindow) *QMdiSubWindow {
+	if h == nil {
+		return nil
+	}
 	return &QMdiSubWindow{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmenu.go b/qt/gen_qmenu.go
index 412a3cfd..075d2987 100644
--- a/qt/gen_qmenu.go
+++ b/qt/gen_qmenu.go
@@ -29,6 +29,9 @@ func (this *QMenu) cPointer() *C.QMenu {
 }
 
 func newQMenu(h *C.QMenu) *QMenu {
+	if h == nil {
+		return nil
+	}
 	return &QMenu{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmenubar.go b/qt/gen_qmenubar.go
index 3422f005..718ed96d 100644
--- a/qt/gen_qmenubar.go
+++ b/qt/gen_qmenubar.go
@@ -29,6 +29,9 @@ func (this *QMenuBar) cPointer() *C.QMenuBar {
 }
 
 func newQMenuBar(h *C.QMenuBar) *QMenuBar {
+	if h == nil {
+		return nil
+	}
 	return &QMenuBar{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmessageauthenticationcode.go b/qt/gen_qmessageauthenticationcode.go
index 6c368edf..831ff985 100644
--- a/qt/gen_qmessageauthenticationcode.go
+++ b/qt/gen_qmessageauthenticationcode.go
@@ -27,6 +27,9 @@ func (this *QMessageAuthenticationCode) cPointer() *C.QMessageAuthenticationCode
 }
 
 func newQMessageAuthenticationCode(h *C.QMessageAuthenticationCode) *QMessageAuthenticationCode {
+	if h == nil {
+		return nil
+	}
 	return &QMessageAuthenticationCode{h: h}
 }
 
diff --git a/qt/gen_qmessagebox.go b/qt/gen_qmessagebox.go
index 65d0f4fc..4a27738e 100644
--- a/qt/gen_qmessagebox.go
+++ b/qt/gen_qmessagebox.go
@@ -29,6 +29,9 @@ func (this *QMessageBox) cPointer() *C.QMessageBox {
 }
 
 func newQMessageBox(h *C.QMessageBox) *QMessageBox {
+	if h == nil {
+		return nil
+	}
 	return &QMessageBox{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmetaobject.go b/qt/gen_qmetaobject.go
index 6e192039..2c8a8f53 100644
--- a/qt/gen_qmetaobject.go
+++ b/qt/gen_qmetaobject.go
@@ -27,6 +27,9 @@ func (this *QMetaMethod) cPointer() *C.QMetaMethod {
 }
 
 func newQMetaMethod(h *C.QMetaMethod) *QMetaMethod {
+	if h == nil {
+		return nil
+	}
 	return &QMetaMethod{h: h}
 }
 
@@ -394,6 +397,9 @@ func (this *QMetaEnum) cPointer() *C.QMetaEnum {
 }
 
 func newQMetaEnum(h *C.QMetaEnum) *QMetaEnum {
+	if h == nil {
+		return nil
+	}
 	return &QMetaEnum{h: h}
 }
 
@@ -523,6 +529,9 @@ func (this *QMetaProperty) cPointer() *C.QMetaProperty {
 }
 
 func newQMetaProperty(h *C.QMetaProperty) *QMetaProperty {
+	if h == nil {
+		return nil
+	}
 	return &QMetaProperty{h: h}
 }
 
@@ -745,6 +754,9 @@ func (this *QMetaClassInfo) cPointer() *C.QMetaClassInfo {
 }
 
 func newQMetaClassInfo(h *C.QMetaClassInfo) *QMetaClassInfo {
+	if h == nil {
+		return nil
+	}
 	return &QMetaClassInfo{h: h}
 }
 
diff --git a/qt/gen_qmetatype.go b/qt/gen_qmetatype.go
index 834af18e..ef131f80 100644
--- a/qt/gen_qmetatype.go
+++ b/qt/gen_qmetatype.go
@@ -27,6 +27,9 @@ func (this *QtPrivate__AbstractDebugStreamFunction) cPointer() *C.QtPrivate__Abs
 }
 
 func newQtPrivate__AbstractDebugStreamFunction(h *C.QtPrivate__AbstractDebugStreamFunction) *QtPrivate__AbstractDebugStreamFunction {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__AbstractDebugStreamFunction{h: h}
 }
 
@@ -56,6 +59,9 @@ func (this *QtPrivate__AbstractComparatorFunction) cPointer() *C.QtPrivate__Abst
 }
 
 func newQtPrivate__AbstractComparatorFunction(h *C.QtPrivate__AbstractComparatorFunction) *QtPrivate__AbstractComparatorFunction {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__AbstractComparatorFunction{h: h}
 }
 
@@ -85,6 +91,9 @@ func (this *QtPrivate__AbstractConverterFunction) cPointer() *C.QtPrivate__Abstr
 }
 
 func newQtPrivate__AbstractConverterFunction(h *C.QtPrivate__AbstractConverterFunction) *QtPrivate__AbstractConverterFunction {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__AbstractConverterFunction{h: h}
 }
 
@@ -114,6 +123,9 @@ func (this *QMetaType) cPointer() *C.QMetaType {
 }
 
 func newQMetaType(h *C.QMetaType) *QMetaType {
+	if h == nil {
+		return nil
+	}
 	return &QMetaType{h: h}
 }
 
@@ -259,6 +271,9 @@ func (this *QtMetaTypePrivate__VariantData) cPointer() *C.QtMetaTypePrivate__Var
 }
 
 func newQtMetaTypePrivate__VariantData(h *C.QtMetaTypePrivate__VariantData) *QtMetaTypePrivate__VariantData {
+	if h == nil {
+		return nil
+	}
 	return &QtMetaTypePrivate__VariantData{h: h}
 }
 
@@ -288,6 +303,9 @@ func (this *QtMetaTypePrivate__VectorBoolElements) cPointer() *C.QtMetaTypePriva
 }
 
 func newQtMetaTypePrivate__VectorBoolElements(h *C.QtMetaTypePrivate__VectorBoolElements) *QtMetaTypePrivate__VectorBoolElements {
+	if h == nil {
+		return nil
+	}
 	return &QtMetaTypePrivate__VectorBoolElements{h: h}
 }
 
@@ -311,6 +329,9 @@ func (this *QtMetaTypePrivate__QSequentialIterableImpl) cPointer() *C.QtMetaType
 }
 
 func newQtMetaTypePrivate__QSequentialIterableImpl(h *C.QtMetaTypePrivate__QSequentialIterableImpl) *QtMetaTypePrivate__QSequentialIterableImpl {
+	if h == nil {
+		return nil
+	}
 	return &QtMetaTypePrivate__QSequentialIterableImpl{h: h}
 }
 
@@ -409,6 +430,9 @@ func (this *QtMetaTypePrivate__QAssociativeIterableImpl) cPointer() *C.QtMetaTyp
 }
 
 func newQtMetaTypePrivate__QAssociativeIterableImpl(h *C.QtMetaTypePrivate__QAssociativeIterableImpl) *QtMetaTypePrivate__QAssociativeIterableImpl {
+	if h == nil {
+		return nil
+	}
 	return &QtMetaTypePrivate__QAssociativeIterableImpl{h: h}
 }
 
@@ -496,6 +520,9 @@ func (this *QtMetaTypePrivate__QPairVariantInterfaceImpl) cPointer() *C.QtMetaTy
 }
 
 func newQtMetaTypePrivate__QPairVariantInterfaceImpl(h *C.QtMetaTypePrivate__QPairVariantInterfaceImpl) *QtMetaTypePrivate__QPairVariantInterfaceImpl {
+	if h == nil {
+		return nil
+	}
 	return &QtMetaTypePrivate__QPairVariantInterfaceImpl{h: h}
 }
 
diff --git a/qt/gen_qmimedata.go b/qt/gen_qmimedata.go
index e9f989d0..1b57efa5 100644
--- a/qt/gen_qmimedata.go
+++ b/qt/gen_qmimedata.go
@@ -28,6 +28,9 @@ func (this *QMimeData) cPointer() *C.QMimeData {
 }
 
 func newQMimeData(h *C.QMimeData) *QMimeData {
+	if h == nil {
+		return nil
+	}
 	return &QMimeData{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmimedatabase.go b/qt/gen_qmimedatabase.go
index 2f9f988f..d270e98f 100644
--- a/qt/gen_qmimedatabase.go
+++ b/qt/gen_qmimedatabase.go
@@ -27,6 +27,9 @@ func (this *QMimeDatabase) cPointer() *C.QMimeDatabase {
 }
 
 func newQMimeDatabase(h *C.QMimeDatabase) *QMimeDatabase {
+	if h == nil {
+		return nil
+	}
 	return &QMimeDatabase{h: h}
 }
 
diff --git a/qt/gen_qmimetype.go b/qt/gen_qmimetype.go
index e3e43666..9ec283e4 100644
--- a/qt/gen_qmimetype.go
+++ b/qt/gen_qmimetype.go
@@ -26,6 +26,9 @@ func (this *QMimeType) cPointer() *C.QMimeType {
 }
 
 func newQMimeType(h *C.QMimeType) *QMimeType {
+	if h == nil {
+		return nil
+	}
 	return &QMimeType{h: h}
 }
 
diff --git a/qt/gen_qmouseeventtransition.go b/qt/gen_qmouseeventtransition.go
index dfcd9edc..b6df306c 100644
--- a/qt/gen_qmouseeventtransition.go
+++ b/qt/gen_qmouseeventtransition.go
@@ -28,6 +28,9 @@ func (this *QMouseEventTransition) cPointer() *C.QMouseEventTransition {
 }
 
 func newQMouseEventTransition(h *C.QMouseEventTransition) *QMouseEventTransition {
+	if h == nil {
+		return nil
+	}
 	return &QMouseEventTransition{h: h, QEventTransition: newQEventTransition_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmovie.go b/qt/gen_qmovie.go
index f40ac902..1572278a 100644
--- a/qt/gen_qmovie.go
+++ b/qt/gen_qmovie.go
@@ -29,6 +29,9 @@ func (this *QMovie) cPointer() *C.QMovie {
 }
 
 func newQMovie(h *C.QMovie) *QMovie {
+	if h == nil {
+		return nil
+	}
 	return &QMovie{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qmutex.go b/qt/gen_qmutex.go
index bddaba1b..c7a4c2ea 100644
--- a/qt/gen_qmutex.go
+++ b/qt/gen_qmutex.go
@@ -26,6 +26,9 @@ func (this *QBasicMutex) cPointer() *C.QBasicMutex {
 }
 
 func newQBasicMutex(h *C.QBasicMutex) *QBasicMutex {
+	if h == nil {
+		return nil
+	}
 	return &QBasicMutex{h: h}
 }
 
@@ -84,6 +87,9 @@ func (this *QMutex) cPointer() *C.QMutex {
 }
 
 func newQMutex(h *C.QMutex) *QMutex {
+	if h == nil {
+		return nil
+	}
 	return &QMutex{h: h, QBasicMutex: newQBasicMutex_U(unsafe.Pointer(h))}
 }
 
@@ -147,6 +153,9 @@ func (this *QRecursiveMutex) cPointer() *C.QRecursiveMutex {
 }
 
 func newQRecursiveMutex(h *C.QRecursiveMutex) *QRecursiveMutex {
+	if h == nil {
+		return nil
+	}
 	return &QRecursiveMutex{h: h}
 }
 
@@ -176,6 +185,9 @@ func (this *QMutexLocker) cPointer() *C.QMutexLocker {
 }
 
 func newQMutexLocker(h *C.QMutexLocker) *QMutexLocker {
+	if h == nil {
+		return nil
+	}
 	return &QMutexLocker{h: h}
 }
 
diff --git a/qt/gen_qnamespace.go b/qt/gen_qnamespace.go
index aad604c6..9276888a 100644
--- a/qt/gen_qnamespace.go
+++ b/qt/gen_qnamespace.go
@@ -26,6 +26,9 @@ func (this *QInternal) cPointer() *C.QInternal {
 }
 
 func newQInternal(h *C.QInternal) *QInternal {
+	if h == nil {
+		return nil
+	}
 	return &QInternal{h: h}
 }
 
diff --git a/qt/gen_qobject.go b/qt/gen_qobject.go
index 9d36ff7f..0167888e 100644
--- a/qt/gen_qobject.go
+++ b/qt/gen_qobject.go
@@ -28,6 +28,9 @@ func (this *QObjectData) cPointer() *C.QObjectData {
 }
 
 func newQObjectData(h *C.QObjectData) *QObjectData {
+	if h == nil {
+		return nil
+	}
 	return &QObjectData{h: h}
 }
 
@@ -56,6 +59,9 @@ func (this *QObject) cPointer() *C.QObject {
 }
 
 func newQObject(h *C.QObject) *QObject {
+	if h == nil {
+		return nil
+	}
 	return &QObject{h: h}
 }
 
@@ -420,6 +426,9 @@ func (this *QObjectUserData) cPointer() *C.QObjectUserData {
 }
 
 func newQObjectUserData(h *C.QObjectUserData) *QObjectUserData {
+	if h == nil {
+		return nil
+	}
 	return &QObjectUserData{h: h}
 }
 
@@ -449,6 +458,9 @@ func (this *QSignalBlocker) cPointer() *C.QSignalBlocker {
 }
 
 func newQSignalBlocker(h *C.QSignalBlocker) *QSignalBlocker {
+	if h == nil {
+		return nil
+	}
 	return &QSignalBlocker{h: h}
 }
 
diff --git a/qt/gen_qobjectcleanuphandler.go b/qt/gen_qobjectcleanuphandler.go
index 49a9c98a..ea13ffec 100644
--- a/qt/gen_qobjectcleanuphandler.go
+++ b/qt/gen_qobjectcleanuphandler.go
@@ -27,6 +27,9 @@ func (this *QObjectCleanupHandler) cPointer() *C.QObjectCleanupHandler {
 }
 
 func newQObjectCleanupHandler(h *C.QObjectCleanupHandler) *QObjectCleanupHandler {
+	if h == nil {
+		return nil
+	}
 	return &QObjectCleanupHandler{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qobjectdefs.go b/qt/gen_qobjectdefs.go
index a64db85d..b2b2d014 100644
--- a/qt/gen_qobjectdefs.go
+++ b/qt/gen_qobjectdefs.go
@@ -27,6 +27,9 @@ func (this *QGenericArgument) cPointer() *C.QGenericArgument {
 }
 
 func newQGenericArgument(h *C.QGenericArgument) *QGenericArgument {
+	if h == nil {
+		return nil
+	}
 	return &QGenericArgument{h: h}
 }
 
@@ -76,6 +79,9 @@ func (this *QGenericReturnArgument) cPointer() *C.QGenericReturnArgument {
 }
 
 func newQGenericReturnArgument(h *C.QGenericReturnArgument) *QGenericReturnArgument {
+	if h == nil {
+		return nil
+	}
 	return &QGenericReturnArgument{h: h, QGenericArgument: newQGenericArgument_U(unsafe.Pointer(h))}
 }
 
@@ -119,6 +125,9 @@ func (this *QMetaObject) cPointer() *C.QMetaObject {
 }
 
 func newQMetaObject(h *C.QMetaObject) *QMetaObject {
+	if h == nil {
+		return nil
+	}
 	return &QMetaObject{h: h}
 }
 
@@ -815,6 +824,9 @@ func (this *QMetaObject__Connection) cPointer() *C.QMetaObject__Connection {
 }
 
 func newQMetaObject__Connection(h *C.QMetaObject__Connection) *QMetaObject__Connection {
+	if h == nil {
+		return nil
+	}
 	return &QMetaObject__Connection{h: h}
 }
 
@@ -850,6 +862,9 @@ func (this *QMetaObject__SuperData) cPointer() *C.QMetaObject__SuperData {
 }
 
 func newQMetaObject__SuperData(h *C.QMetaObject__SuperData) *QMetaObject__SuperData {
+	if h == nil {
+		return nil
+	}
 	return &QMetaObject__SuperData{h: h}
 }
 
diff --git a/qt/gen_qoffscreensurface.go b/qt/gen_qoffscreensurface.go
index 9ffec64e..38fb637b 100644
--- a/qt/gen_qoffscreensurface.go
+++ b/qt/gen_qoffscreensurface.go
@@ -30,6 +30,9 @@ func (this *QOffscreenSurface) cPointer() *C.QOffscreenSurface {
 }
 
 func newQOffscreenSurface(h *C.QOffscreenSurface) *QOffscreenSurface {
+	if h == nil {
+		return nil
+	}
 	return &QOffscreenSurface{h: h, QObject: newQObject_U(unsafe.Pointer(h)), QSurface: newQSurface_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qoperatingsystemversion.go b/qt/gen_qoperatingsystemversion.go
index e2058899..d7589cb6 100644
--- a/qt/gen_qoperatingsystemversion.go
+++ b/qt/gen_qoperatingsystemversion.go
@@ -27,6 +27,9 @@ func (this *QOperatingSystemVersion) cPointer() *C.QOperatingSystemVersion {
 }
 
 func newQOperatingSystemVersion(h *C.QOperatingSystemVersion) *QOperatingSystemVersion {
+	if h == nil {
+		return nil
+	}
 	return &QOperatingSystemVersion{h: h}
 }
 
diff --git a/qt/gen_qpagedpaintdevice.go b/qt/gen_qpagedpaintdevice.go
index 32eaca3e..e2a6472b 100644
--- a/qt/gen_qpagedpaintdevice.go
+++ b/qt/gen_qpagedpaintdevice.go
@@ -28,6 +28,9 @@ func (this *QPagedPaintDevice) cPointer() *C.QPagedPaintDevice {
 }
 
 func newQPagedPaintDevice(h *C.QPagedPaintDevice) *QPagedPaintDevice {
+	if h == nil {
+		return nil
+	}
 	return &QPagedPaintDevice{h: h, QPaintDevice: newQPaintDevice_U(unsafe.Pointer(h))}
 }
 
@@ -131,6 +134,9 @@ func (this *QPagedPaintDevice__Margins) cPointer() *C.QPagedPaintDevice__Margins
 }
 
 func newQPagedPaintDevice__Margins(h *C.QPagedPaintDevice__Margins) *QPagedPaintDevice__Margins {
+	if h == nil {
+		return nil
+	}
 	return &QPagedPaintDevice__Margins{h: h}
 }
 
diff --git a/qt/gen_qpagelayout.go b/qt/gen_qpagelayout.go
index 7a19307c..ef7ab963 100644
--- a/qt/gen_qpagelayout.go
+++ b/qt/gen_qpagelayout.go
@@ -27,6 +27,9 @@ func (this *QPageLayout) cPointer() *C.QPageLayout {
 }
 
 func newQPageLayout(h *C.QPageLayout) *QPageLayout {
+	if h == nil {
+		return nil
+	}
 	return &QPageLayout{h: h}
 }
 
diff --git a/qt/gen_qpagesize.go b/qt/gen_qpagesize.go
index 22eba8e0..289f54bc 100644
--- a/qt/gen_qpagesize.go
+++ b/qt/gen_qpagesize.go
@@ -27,6 +27,9 @@ func (this *QPageSize) cPointer() *C.QPageSize {
 }
 
 func newQPageSize(h *C.QPageSize) *QPageSize {
+	if h == nil {
+		return nil
+	}
 	return &QPageSize{h: h}
 }
 
diff --git a/qt/gen_qpaintdevice.go b/qt/gen_qpaintdevice.go
index 33364065..d5188783 100644
--- a/qt/gen_qpaintdevice.go
+++ b/qt/gen_qpaintdevice.go
@@ -26,6 +26,9 @@ func (this *QPaintDevice) cPointer() *C.QPaintDevice {
 }
 
 func newQPaintDevice(h *C.QPaintDevice) *QPaintDevice {
+	if h == nil {
+		return nil
+	}
 	return &QPaintDevice{h: h}
 }
 
diff --git a/qt/gen_qpaintdevicewindow.go b/qt/gen_qpaintdevicewindow.go
index 32d2dfd1..fc23c533 100644
--- a/qt/gen_qpaintdevicewindow.go
+++ b/qt/gen_qpaintdevicewindow.go
@@ -28,6 +28,9 @@ func (this *QPaintDeviceWindow) cPointer() *C.QPaintDeviceWindow {
 }
 
 func newQPaintDeviceWindow(h *C.QPaintDeviceWindow) *QPaintDeviceWindow {
+	if h == nil {
+		return nil
+	}
 	return &QPaintDeviceWindow{h: h, QWindow: newQWindow_U(unsafe.Pointer(h)), QPaintDevice: newQPaintDevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpaintengine.go b/qt/gen_qpaintengine.go
index d3f9e3cb..e8cefaf6 100644
--- a/qt/gen_qpaintengine.go
+++ b/qt/gen_qpaintengine.go
@@ -27,6 +27,9 @@ func (this *QTextItem) cPointer() *C.QTextItem {
 }
 
 func newQTextItem(h *C.QTextItem) *QTextItem {
+	if h == nil {
+		return nil
+	}
 	return &QTextItem{h: h}
 }
 
@@ -90,6 +93,9 @@ func (this *QPaintEngine) cPointer() *C.QPaintEngine {
 }
 
 func newQPaintEngine(h *C.QPaintEngine) *QPaintEngine {
+	if h == nil {
+		return nil
+	}
 	return &QPaintEngine{h: h}
 }
 
@@ -291,6 +297,9 @@ func (this *QPaintEngineState) cPointer() *C.QPaintEngineState {
 }
 
 func newQPaintEngineState(h *C.QPaintEngineState) *QPaintEngineState {
+	if h == nil {
+		return nil
+	}
 	return &QPaintEngineState{h: h}
 }
 
diff --git a/qt/gen_qpainter.go b/qt/gen_qpainter.go
index 3cb45b8c..97e33ce1 100644
--- a/qt/gen_qpainter.go
+++ b/qt/gen_qpainter.go
@@ -27,6 +27,9 @@ func (this *QPainter) cPointer() *C.QPainter {
 }
 
 func newQPainter(h *C.QPainter) *QPainter {
+	if h == nil {
+		return nil
+	}
 	return &QPainter{h: h}
 }
 
@@ -1244,6 +1247,9 @@ func (this *QPainter__PixmapFragment) cPointer() *C.QPainter__PixmapFragment {
 }
 
 func newQPainter__PixmapFragment(h *C.QPainter__PixmapFragment) *QPainter__PixmapFragment {
+	if h == nil {
+		return nil
+	}
 	return &QPainter__PixmapFragment{h: h}
 }
 
diff --git a/qt/gen_qpainterpath.go b/qt/gen_qpainterpath.go
index fed3384d..14241ed3 100644
--- a/qt/gen_qpainterpath.go
+++ b/qt/gen_qpainterpath.go
@@ -27,6 +27,9 @@ func (this *QPainterPath) cPointer() *C.QPainterPath {
 }
 
 func newQPainterPath(h *C.QPainterPath) *QPainterPath {
+	if h == nil {
+		return nil
+	}
 	return &QPainterPath{h: h}
 }
 
@@ -508,6 +511,9 @@ func (this *QPainterPathStroker) cPointer() *C.QPainterPathStroker {
 }
 
 func newQPainterPathStroker(h *C.QPainterPathStroker) *QPainterPathStroker {
+	if h == nil {
+		return nil
+	}
 	return &QPainterPathStroker{h: h}
 }
 
@@ -635,6 +641,9 @@ func (this *QPainterPath__Element) cPointer() *C.QPainterPath__Element {
 }
 
 func newQPainterPath__Element(h *C.QPainterPath__Element) *QPainterPath__Element {
+	if h == nil {
+		return nil
+	}
 	return &QPainterPath__Element{h: h}
 }
 
diff --git a/qt/gen_qpalette.go b/qt/gen_qpalette.go
index 96852ba5..39206fa9 100644
--- a/qt/gen_qpalette.go
+++ b/qt/gen_qpalette.go
@@ -27,6 +27,9 @@ func (this *QPalette) cPointer() *C.QPalette {
 }
 
 func newQPalette(h *C.QPalette) *QPalette {
+	if h == nil {
+		return nil
+	}
 	return &QPalette{h: h}
 }
 
diff --git a/qt/gen_qparallelanimationgroup.go b/qt/gen_qparallelanimationgroup.go
index c2f6ab11..08a5b6f6 100644
--- a/qt/gen_qparallelanimationgroup.go
+++ b/qt/gen_qparallelanimationgroup.go
@@ -27,6 +27,9 @@ func (this *QParallelAnimationGroup) cPointer() *C.QParallelAnimationGroup {
 }
 
 func newQParallelAnimationGroup(h *C.QParallelAnimationGroup) *QParallelAnimationGroup {
+	if h == nil {
+		return nil
+	}
 	return &QParallelAnimationGroup{h: h, QAnimationGroup: newQAnimationGroup_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpauseanimation.go b/qt/gen_qpauseanimation.go
index 7f715460..e8a15145 100644
--- a/qt/gen_qpauseanimation.go
+++ b/qt/gen_qpauseanimation.go
@@ -27,6 +27,9 @@ func (this *QPauseAnimation) cPointer() *C.QPauseAnimation {
 }
 
 func newQPauseAnimation(h *C.QPauseAnimation) *QPauseAnimation {
+	if h == nil {
+		return nil
+	}
 	return &QPauseAnimation{h: h, QAbstractAnimation: newQAbstractAnimation_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpdfwriter.go b/qt/gen_qpdfwriter.go
index d28fd8e1..c85de139 100644
--- a/qt/gen_qpdfwriter.go
+++ b/qt/gen_qpdfwriter.go
@@ -29,6 +29,9 @@ func (this *QPdfWriter) cPointer() *C.QPdfWriter {
 }
 
 func newQPdfWriter(h *C.QPdfWriter) *QPdfWriter {
+	if h == nil {
+		return nil
+	}
 	return &QPdfWriter{h: h, QObject: newQObject_U(unsafe.Pointer(h)), QPagedPaintDevice: newQPagedPaintDevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpen.go b/qt/gen_qpen.go
index 4a05a97e..21f5d16a 100644
--- a/qt/gen_qpen.go
+++ b/qt/gen_qpen.go
@@ -27,6 +27,9 @@ func (this *QPen) cPointer() *C.QPen {
 }
 
 func newQPen(h *C.QPen) *QPen {
+	if h == nil {
+		return nil
+	}
 	return &QPen{h: h}
 }
 
diff --git a/qt/gen_qpicture.go b/qt/gen_qpicture.go
index 88e144df..ecbc604a 100644
--- a/qt/gen_qpicture.go
+++ b/qt/gen_qpicture.go
@@ -28,6 +28,9 @@ func (this *QPicture) cPointer() *C.QPicture {
 }
 
 func newQPicture(h *C.QPicture) *QPicture {
+	if h == nil {
+		return nil
+	}
 	return &QPicture{h: h, QPaintDevice: newQPaintDevice_U(unsafe.Pointer(h))}
 }
 
@@ -256,6 +259,9 @@ func (this *QPictureIO) cPointer() *C.QPictureIO {
 }
 
 func newQPictureIO(h *C.QPictureIO) *QPictureIO {
+	if h == nil {
+		return nil
+	}
 	return &QPictureIO{h: h}
 }
 
diff --git a/qt/gen_qpictureformatplugin.go b/qt/gen_qpictureformatplugin.go
index bac33037..f1fcbe3f 100644
--- a/qt/gen_qpictureformatplugin.go
+++ b/qt/gen_qpictureformatplugin.go
@@ -27,6 +27,9 @@ func (this *QPictureFormatPlugin) cPointer() *C.QPictureFormatPlugin {
 }
 
 func newQPictureFormatPlugin(h *C.QPictureFormatPlugin) *QPictureFormatPlugin {
+	if h == nil {
+		return nil
+	}
 	return &QPictureFormatPlugin{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpixelformat.go b/qt/gen_qpixelformat.go
index 6b2213e3..599ba93e 100644
--- a/qt/gen_qpixelformat.go
+++ b/qt/gen_qpixelformat.go
@@ -26,6 +26,9 @@ func (this *QPixelFormat) cPointer() *C.QPixelFormat {
 }
 
 func newQPixelFormat(h *C.QPixelFormat) *QPixelFormat {
+	if h == nil {
+		return nil
+	}
 	return &QPixelFormat{h: h}
 }
 
diff --git a/qt/gen_qpixmap.go b/qt/gen_qpixmap.go
index 1694047b..596ef060 100644
--- a/qt/gen_qpixmap.go
+++ b/qt/gen_qpixmap.go
@@ -28,6 +28,9 @@ func (this *QPixmap) cPointer() *C.QPixmap {
 }
 
 func newQPixmap(h *C.QPixmap) *QPixmap {
+	if h == nil {
+		return nil
+	}
 	return &QPixmap{h: h, QPaintDevice: newQPaintDevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpixmapcache.go b/qt/gen_qpixmapcache.go
index e39be59d..c83c8ac1 100644
--- a/qt/gen_qpixmapcache.go
+++ b/qt/gen_qpixmapcache.go
@@ -27,6 +27,9 @@ func (this *QPixmapCache) cPointer() *C.QPixmapCache {
 }
 
 func newQPixmapCache(h *C.QPixmapCache) *QPixmapCache {
+	if h == nil {
+		return nil
+	}
 	return &QPixmapCache{h: h}
 }
 
@@ -122,6 +125,9 @@ func (this *QPixmapCache__Key) cPointer() *C.QPixmapCache__Key {
 }
 
 func newQPixmapCache__Key(h *C.QPixmapCache__Key) *QPixmapCache__Key {
+	if h == nil {
+		return nil
+	}
 	return &QPixmapCache__Key{h: h}
 }
 
diff --git a/qt/gen_qplaintextedit.go b/qt/gen_qplaintextedit.go
index b641c2eb..237f3af6 100644
--- a/qt/gen_qplaintextedit.go
+++ b/qt/gen_qplaintextedit.go
@@ -29,6 +29,9 @@ func (this *QPlainTextEdit) cPointer() *C.QPlainTextEdit {
 }
 
 func newQPlainTextEdit(h *C.QPlainTextEdit) *QPlainTextEdit {
+	if h == nil {
+		return nil
+	}
 	return &QPlainTextEdit{h: h, QAbstractScrollArea: newQAbstractScrollArea_U(unsafe.Pointer(h))}
 }
 
@@ -707,6 +710,9 @@ func (this *QPlainTextDocumentLayout) cPointer() *C.QPlainTextDocumentLayout {
 }
 
 func newQPlainTextDocumentLayout(h *C.QPlainTextDocumentLayout) *QPlainTextDocumentLayout {
+	if h == nil {
+		return nil
+	}
 	return &QPlainTextDocumentLayout{h: h, QAbstractTextDocumentLayout: newQAbstractTextDocumentLayout_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qplugin.go b/qt/gen_qplugin.go
index 6a02d473..60f2ff00 100644
--- a/qt/gen_qplugin.go
+++ b/qt/gen_qplugin.go
@@ -27,6 +27,9 @@ func (this *QStaticPlugin) cPointer() *C.QStaticPlugin {
 }
 
 func newQStaticPlugin(h *C.QStaticPlugin) *QStaticPlugin {
+	if h == nil {
+		return nil
+	}
 	return &QStaticPlugin{h: h}
 }
 
diff --git a/qt/gen_qpluginloader.go b/qt/gen_qpluginloader.go
index 971b78f5..cb69adbf 100644
--- a/qt/gen_qpluginloader.go
+++ b/qt/gen_qpluginloader.go
@@ -28,6 +28,9 @@ func (this *QPluginLoader) cPointer() *C.QPluginLoader {
 }
 
 func newQPluginLoader(h *C.QPluginLoader) *QPluginLoader {
+	if h == nil {
+		return nil
+	}
 	return &QPluginLoader{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpoint.go b/qt/gen_qpoint.go
index 3d4401c8..5fe3c520 100644
--- a/qt/gen_qpoint.go
+++ b/qt/gen_qpoint.go
@@ -27,6 +27,9 @@ func (this *QPoint) cPointer() *C.QPoint {
 }
 
 func newQPoint(h *C.QPoint) *QPoint {
+	if h == nil {
+		return nil
+	}
 	return &QPoint{h: h}
 }
 
@@ -142,6 +145,9 @@ func (this *QPointF) cPointer() *C.QPointF {
 }
 
 func newQPointF(h *C.QPointF) *QPointF {
+	if h == nil {
+		return nil
+	}
 	return &QPointF{h: h}
 }
 
diff --git a/qt/gen_qprocess.go b/qt/gen_qprocess.go
index 111e0392..bab55f84 100644
--- a/qt/gen_qprocess.go
+++ b/qt/gen_qprocess.go
@@ -28,6 +28,9 @@ func (this *QProcessEnvironment) cPointer() *C.QProcessEnvironment {
 }
 
 func newQProcessEnvironment(h *C.QProcessEnvironment) *QProcessEnvironment {
+	if h == nil {
+		return nil
+	}
 	return &QProcessEnvironment{h: h}
 }
 
@@ -181,6 +184,9 @@ func (this *QProcess) cPointer() *C.QProcess {
 }
 
 func newQProcess(h *C.QProcess) *QProcess {
+	if h == nil {
+		return nil
+	}
 	return &QProcess{h: h, QIODevice: newQIODevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qprogressbar.go b/qt/gen_qprogressbar.go
index 720b1e84..25e359ea 100644
--- a/qt/gen_qprogressbar.go
+++ b/qt/gen_qprogressbar.go
@@ -29,6 +29,9 @@ func (this *QProgressBar) cPointer() *C.QProgressBar {
 }
 
 func newQProgressBar(h *C.QProgressBar) *QProgressBar {
+	if h == nil {
+		return nil
+	}
 	return &QProgressBar{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qprogressdialog.go b/qt/gen_qprogressdialog.go
index ac22ce3d..fe1bed02 100644
--- a/qt/gen_qprogressdialog.go
+++ b/qt/gen_qprogressdialog.go
@@ -29,6 +29,9 @@ func (this *QProgressDialog) cPointer() *C.QProgressDialog {
 }
 
 func newQProgressDialog(h *C.QProgressDialog) *QProgressDialog {
+	if h == nil {
+		return nil
+	}
 	return &QProgressDialog{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpropertyanimation.go b/qt/gen_qpropertyanimation.go
index 7891c2c8..e4426e82 100644
--- a/qt/gen_qpropertyanimation.go
+++ b/qt/gen_qpropertyanimation.go
@@ -28,6 +28,9 @@ func (this *QPropertyAnimation) cPointer() *C.QPropertyAnimation {
 }
 
 func newQPropertyAnimation(h *C.QPropertyAnimation) *QPropertyAnimation {
+	if h == nil {
+		return nil
+	}
 	return &QPropertyAnimation{h: h, QVariantAnimation: newQVariantAnimation_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qproxystyle.go b/qt/gen_qproxystyle.go
index aa7145b5..480769a3 100644
--- a/qt/gen_qproxystyle.go
+++ b/qt/gen_qproxystyle.go
@@ -28,6 +28,9 @@ func (this *QProxyStyle) cPointer() *C.QProxyStyle {
 }
 
 func newQProxyStyle(h *C.QProxyStyle) *QProxyStyle {
+	if h == nil {
+		return nil
+	}
 	return &QProxyStyle{h: h, QCommonStyle: newQCommonStyle_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qpushbutton.go b/qt/gen_qpushbutton.go
index 0108ff8c..e6205e34 100644
--- a/qt/gen_qpushbutton.go
+++ b/qt/gen_qpushbutton.go
@@ -28,6 +28,9 @@ func (this *QPushButton) cPointer() *C.QPushButton {
 }
 
 func newQPushButton(h *C.QPushButton) *QPushButton {
+	if h == nil {
+		return nil
+	}
 	return &QPushButton{h: h, QAbstractButton: newQAbstractButton_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qquaternion.go b/qt/gen_qquaternion.go
index 62dd9789..804ca996 100644
--- a/qt/gen_qquaternion.go
+++ b/qt/gen_qquaternion.go
@@ -27,6 +27,9 @@ func (this *QQuaternion) cPointer() *C.QQuaternion {
 }
 
 func newQQuaternion(h *C.QQuaternion) *QQuaternion {
+	if h == nil {
+		return nil
+	}
 	return &QQuaternion{h: h}
 }
 
diff --git a/qt/gen_qradiobutton.go b/qt/gen_qradiobutton.go
index 517446c5..241ef760 100644
--- a/qt/gen_qradiobutton.go
+++ b/qt/gen_qradiobutton.go
@@ -28,6 +28,9 @@ func (this *QRadioButton) cPointer() *C.QRadioButton {
 }
 
 func newQRadioButton(h *C.QRadioButton) *QRadioButton {
+	if h == nil {
+		return nil
+	}
 	return &QRadioButton{h: h, QAbstractButton: newQAbstractButton_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qrandom.go b/qt/gen_qrandom.go
index 5617f030..1def9519 100644
--- a/qt/gen_qrandom.go
+++ b/qt/gen_qrandom.go
@@ -27,6 +27,9 @@ func (this *QRandomGenerator) cPointer() *C.QRandomGenerator {
 }
 
 func newQRandomGenerator(h *C.QRandomGenerator) *QRandomGenerator {
+	if h == nil {
+		return nil
+	}
 	return &QRandomGenerator{h: h}
 }
 
@@ -177,6 +180,9 @@ func (this *QRandomGenerator64) cPointer() *C.QRandomGenerator64 {
 }
 
 func newQRandomGenerator64(h *C.QRandomGenerator64) *QRandomGenerator64 {
+	if h == nil {
+		return nil
+	}
 	return &QRandomGenerator64{h: h, QRandomGenerator: newQRandomGenerator_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qrasterwindow.go b/qt/gen_qrasterwindow.go
index fb2fdce9..b5c60003 100644
--- a/qt/gen_qrasterwindow.go
+++ b/qt/gen_qrasterwindow.go
@@ -27,6 +27,9 @@ func (this *QRasterWindow) cPointer() *C.QRasterWindow {
 }
 
 func newQRasterWindow(h *C.QRasterWindow) *QRasterWindow {
+	if h == nil {
+		return nil
+	}
 	return &QRasterWindow{h: h, QPaintDeviceWindow: newQPaintDeviceWindow_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qrawfont.go b/qt/gen_qrawfont.go
index 709f5104..04cbc761 100644
--- a/qt/gen_qrawfont.go
+++ b/qt/gen_qrawfont.go
@@ -27,6 +27,9 @@ func (this *QRawFont) cPointer() *C.QRawFont {
 }
 
 func newQRawFont(h *C.QRawFont) *QRawFont {
+	if h == nil {
+		return nil
+	}
 	return &QRawFont{h: h}
 }
 
diff --git a/qt/gen_qreadwritelock.go b/qt/gen_qreadwritelock.go
index 9c184027..b5c3fbc2 100644
--- a/qt/gen_qreadwritelock.go
+++ b/qt/gen_qreadwritelock.go
@@ -26,6 +26,9 @@ func (this *QReadWriteLock) cPointer() *C.QReadWriteLock {
 }
 
 func newQReadWriteLock(h *C.QReadWriteLock) *QReadWriteLock {
+	if h == nil {
+		return nil
+	}
 	return &QReadWriteLock{h: h}
 }
 
@@ -93,6 +96,9 @@ func (this *QReadLocker) cPointer() *C.QReadLocker {
 }
 
 func newQReadLocker(h *C.QReadLocker) *QReadLocker {
+	if h == nil {
+		return nil
+	}
 	return &QReadLocker{h: h}
 }
 
@@ -135,6 +141,9 @@ func (this *QWriteLocker) cPointer() *C.QWriteLocker {
 }
 
 func newQWriteLocker(h *C.QWriteLocker) *QWriteLocker {
+	if h == nil {
+		return nil
+	}
 	return &QWriteLocker{h: h}
 }
 
diff --git a/qt/gen_qrect.go b/qt/gen_qrect.go
index e663520d..562183cd 100644
--- a/qt/gen_qrect.go
+++ b/qt/gen_qrect.go
@@ -27,6 +27,9 @@ func (this *QRect) cPointer() *C.QRect {
 }
 
 func newQRect(h *C.QRect) *QRect {
+	if h == nil {
+		return nil
+	}
 	return &QRect{h: h}
 }
 
@@ -499,6 +502,9 @@ func (this *QRectF) cPointer() *C.QRectF {
 }
 
 func newQRectF(h *C.QRectF) *QRectF {
+	if h == nil {
+		return nil
+	}
 	return &QRectF{h: h}
 }
 
diff --git a/qt/gen_qrefcount.go b/qt/gen_qrefcount.go
index 0d426a8a..2cb20956 100644
--- a/qt/gen_qrefcount.go
+++ b/qt/gen_qrefcount.go
@@ -26,6 +26,9 @@ func (this *QtPrivate__RefCount) cPointer() *C.QtPrivate__RefCount {
 }
 
 func newQtPrivate__RefCount(h *C.QtPrivate__RefCount) *QtPrivate__RefCount {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__RefCount{h: h}
 }
 
diff --git a/qt/gen_qregexp.go b/qt/gen_qregexp.go
index 861e3928..c7851179 100644
--- a/qt/gen_qregexp.go
+++ b/qt/gen_qregexp.go
@@ -26,6 +26,9 @@ func (this *QRegExp) cPointer() *C.QRegExp {
 }
 
 func newQRegExp(h *C.QRegExp) *QRegExp {
+	if h == nil {
+		return nil
+	}
 	return &QRegExp{h: h}
 }
 
diff --git a/qt/gen_qregion.go b/qt/gen_qregion.go
index 7e1b9f4c..570eec61 100644
--- a/qt/gen_qregion.go
+++ b/qt/gen_qregion.go
@@ -27,6 +27,9 @@ func (this *QRegion) cPointer() *C.QRegion {
 }
 
 func newQRegion(h *C.QRegion) *QRegion {
+	if h == nil {
+		return nil
+	}
 	return &QRegion{h: h}
 }
 
diff --git a/qt/gen_qregularexpression.go b/qt/gen_qregularexpression.go
index da55ccfc..394d778d 100644
--- a/qt/gen_qregularexpression.go
+++ b/qt/gen_qregularexpression.go
@@ -27,6 +27,9 @@ func (this *QRegularExpression) cPointer() *C.QRegularExpression {
 }
 
 func newQRegularExpression(h *C.QRegularExpression) *QRegularExpression {
+	if h == nil {
+		return nil
+	}
 	return &QRegularExpression{h: h}
 }
 
@@ -300,6 +303,9 @@ func (this *QRegularExpressionMatch) cPointer() *C.QRegularExpressionMatch {
 }
 
 func newQRegularExpressionMatch(h *C.QRegularExpressionMatch) *QRegularExpressionMatch {
+	if h == nil {
+		return nil
+	}
 	return &QRegularExpressionMatch{h: h}
 }
 
@@ -479,6 +485,9 @@ func (this *QRegularExpressionMatchIterator) cPointer() *C.QRegularExpressionMat
 }
 
 func newQRegularExpressionMatchIterator(h *C.QRegularExpressionMatchIterator) *QRegularExpressionMatchIterator {
+	if h == nil {
+		return nil
+	}
 	return &QRegularExpressionMatchIterator{h: h}
 }
 
diff --git a/qt/gen_qresource.go b/qt/gen_qresource.go
index ae9a1877..477cb42a 100644
--- a/qt/gen_qresource.go
+++ b/qt/gen_qresource.go
@@ -27,6 +27,9 @@ func (this *QResource) cPointer() *C.QResource {
 }
 
 func newQResource(h *C.QResource) *QResource {
+	if h == nil {
+		return nil
+	}
 	return &QResource{h: h}
 }
 
diff --git a/qt/gen_qresultstore.go b/qt/gen_qresultstore.go
index dd77c657..b24b6414 100644
--- a/qt/gen_qresultstore.go
+++ b/qt/gen_qresultstore.go
@@ -27,6 +27,9 @@ func (this *QtPrivate__ResultItem) cPointer() *C.QtPrivate__ResultItem {
 }
 
 func newQtPrivate__ResultItem(h *C.QtPrivate__ResultItem) *QtPrivate__ResultItem {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__ResultItem{h: h}
 }
 
@@ -71,6 +74,9 @@ func (this *QtPrivate__ResultIteratorBase) cPointer() *C.QtPrivate__ResultIterat
 }
 
 func newQtPrivate__ResultIteratorBase(h *C.QtPrivate__ResultIteratorBase) *QtPrivate__ResultIteratorBase {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__ResultIteratorBase{h: h}
 }
 
@@ -150,6 +156,9 @@ func (this *QtPrivate__ResultStoreBase) cPointer() *C.QtPrivate__ResultStoreBase
 }
 
 func newQtPrivate__ResultStoreBase(h *C.QtPrivate__ResultStoreBase) *QtPrivate__ResultStoreBase {
+	if h == nil {
+		return nil
+	}
 	return &QtPrivate__ResultStoreBase{h: h}
 }
 
diff --git a/qt/gen_qrgba64.go b/qt/gen_qrgba64.go
index b485e50e..543d56b4 100644
--- a/qt/gen_qrgba64.go
+++ b/qt/gen_qrgba64.go
@@ -27,6 +27,9 @@ func (this *QRgba64) cPointer() *C.QRgba64 {
 }
 
 func newQRgba64(h *C.QRgba64) *QRgba64 {
+	if h == nil {
+		return nil
+	}
 	return &QRgba64{h: h}
 }
 
diff --git a/qt/gen_qrubberband.go b/qt/gen_qrubberband.go
index 181910ff..7ef9914d 100644
--- a/qt/gen_qrubberband.go
+++ b/qt/gen_qrubberband.go
@@ -27,6 +27,9 @@ func (this *QRubberBand) cPointer() *C.QRubberBand {
 }
 
 func newQRubberBand(h *C.QRubberBand) *QRubberBand {
+	if h == nil {
+		return nil
+	}
 	return &QRubberBand{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qrunnable.go b/qt/gen_qrunnable.go
index a7b8e542..035143d2 100644
--- a/qt/gen_qrunnable.go
+++ b/qt/gen_qrunnable.go
@@ -26,6 +26,9 @@ func (this *QRunnable) cPointer() *C.QRunnable {
 }
 
 func newQRunnable(h *C.QRunnable) *QRunnable {
+	if h == nil {
+		return nil
+	}
 	return &QRunnable{h: h}
 }
 
diff --git a/qt/gen_qsavefile.go b/qt/gen_qsavefile.go
index cf4994ba..330d8bca 100644
--- a/qt/gen_qsavefile.go
+++ b/qt/gen_qsavefile.go
@@ -27,6 +27,9 @@ func (this *QSaveFile) cPointer() *C.QSaveFile {
 }
 
 func newQSaveFile(h *C.QSaveFile) *QSaveFile {
+	if h == nil {
+		return nil
+	}
 	return &QSaveFile{h: h, QFileDevice: newQFileDevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qscopedpointer.go b/qt/gen_qscopedpointer.go
index e9f2ee5a..4bfa6631 100644
--- a/qt/gen_qscopedpointer.go
+++ b/qt/gen_qscopedpointer.go
@@ -26,6 +26,9 @@ func (this *QScopedPointerPodDeleter) cPointer() *C.QScopedPointerPodDeleter {
 }
 
 func newQScopedPointerPodDeleter(h *C.QScopedPointerPodDeleter) *QScopedPointerPodDeleter {
+	if h == nil {
+		return nil
+	}
 	return &QScopedPointerPodDeleter{h: h}
 }
 
diff --git a/qt/gen_qscreen.go b/qt/gen_qscreen.go
index 6177c843..d7b9b5cc 100644
--- a/qt/gen_qscreen.go
+++ b/qt/gen_qscreen.go
@@ -29,6 +29,9 @@ func (this *QScreen) cPointer() *C.QScreen {
 }
 
 func newQScreen(h *C.QScreen) *QScreen {
+	if h == nil {
+		return nil
+	}
 	return &QScreen{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qscrollarea.go b/qt/gen_qscrollarea.go
index 568a19e1..e67d539b 100644
--- a/qt/gen_qscrollarea.go
+++ b/qt/gen_qscrollarea.go
@@ -28,6 +28,9 @@ func (this *QScrollArea) cPointer() *C.QScrollArea {
 }
 
 func newQScrollArea(h *C.QScrollArea) *QScrollArea {
+	if h == nil {
+		return nil
+	}
 	return &QScrollArea{h: h, QAbstractScrollArea: newQAbstractScrollArea_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qscrollbar.go b/qt/gen_qscrollbar.go
index 60565de2..cfadc69b 100644
--- a/qt/gen_qscrollbar.go
+++ b/qt/gen_qscrollbar.go
@@ -28,6 +28,9 @@ func (this *QScrollBar) cPointer() *C.QScrollBar {
 }
 
 func newQScrollBar(h *C.QScrollBar) *QScrollBar {
+	if h == nil {
+		return nil
+	}
 	return &QScrollBar{h: h, QAbstractSlider: newQAbstractSlider_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qscroller.go b/qt/gen_qscroller.go
index 29d3ca9f..eb6c0558 100644
--- a/qt/gen_qscroller.go
+++ b/qt/gen_qscroller.go
@@ -29,6 +29,9 @@ func (this *QScroller) cPointer() *C.QScroller {
 }
 
 func newQScroller(h *C.QScroller) *QScroller {
+	if h == nil {
+		return nil
+	}
 	return &QScroller{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qscrollerproperties.go b/qt/gen_qscrollerproperties.go
index 2b704f8f..a165a768 100644
--- a/qt/gen_qscrollerproperties.go
+++ b/qt/gen_qscrollerproperties.go
@@ -27,6 +27,9 @@ func (this *QScrollerProperties) cPointer() *C.QScrollerProperties {
 }
 
 func newQScrollerProperties(h *C.QScrollerProperties) *QScrollerProperties {
+	if h == nil {
+		return nil
+	}
 	return &QScrollerProperties{h: h}
 }
 
diff --git a/qt/gen_qsemaphore.go b/qt/gen_qsemaphore.go
index 50ffaeb9..beb883dc 100644
--- a/qt/gen_qsemaphore.go
+++ b/qt/gen_qsemaphore.go
@@ -26,6 +26,9 @@ func (this *QSemaphore) cPointer() *C.QSemaphore {
 }
 
 func newQSemaphore(h *C.QSemaphore) *QSemaphore {
+	if h == nil {
+		return nil
+	}
 	return &QSemaphore{h: h}
 }
 
@@ -97,6 +100,9 @@ func (this *QSemaphoreReleaser) cPointer() *C.QSemaphoreReleaser {
 }
 
 func newQSemaphoreReleaser(h *C.QSemaphoreReleaser) *QSemaphoreReleaser {
+	if h == nil {
+		return nil
+	}
 	return &QSemaphoreReleaser{h: h}
 }
 
diff --git a/qt/gen_qsequentialanimationgroup.go b/qt/gen_qsequentialanimationgroup.go
index 953465e9..ab384453 100644
--- a/qt/gen_qsequentialanimationgroup.go
+++ b/qt/gen_qsequentialanimationgroup.go
@@ -28,6 +28,9 @@ func (this *QSequentialAnimationGroup) cPointer() *C.QSequentialAnimationGroup {
 }
 
 func newQSequentialAnimationGroup(h *C.QSequentialAnimationGroup) *QSequentialAnimationGroup {
+	if h == nil {
+		return nil
+	}
 	return &QSequentialAnimationGroup{h: h, QAnimationGroup: newQAnimationGroup_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsessionmanager.go b/qt/gen_qsessionmanager.go
index bcaf9d6b..a8dfcb6c 100644
--- a/qt/gen_qsessionmanager.go
+++ b/qt/gen_qsessionmanager.go
@@ -27,6 +27,9 @@ func (this *QSessionManager) cPointer() *C.QSessionManager {
 }
 
 func newQSessionManager(h *C.QSessionManager) *QSessionManager {
+	if h == nil {
+		return nil
+	}
 	return &QSessionManager{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsettings.go b/qt/gen_qsettings.go
index ffa1c43c..2b5e3096 100644
--- a/qt/gen_qsettings.go
+++ b/qt/gen_qsettings.go
@@ -28,6 +28,9 @@ func (this *QSettings) cPointer() *C.QSettings {
 }
 
 func newQSettings(h *C.QSettings) *QSettings {
+	if h == nil {
+		return nil
+	}
 	return &QSettings{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qshareddata.go b/qt/gen_qshareddata.go
index ff809e88..45515a13 100644
--- a/qt/gen_qshareddata.go
+++ b/qt/gen_qshareddata.go
@@ -26,6 +26,9 @@ func (this *QSharedData) cPointer() *C.QSharedData {
 }
 
 func newQSharedData(h *C.QSharedData) *QSharedData {
+	if h == nil {
+		return nil
+	}
 	return &QSharedData{h: h}
 }
 
diff --git a/qt/gen_qsharedmemory.go b/qt/gen_qsharedmemory.go
index 1a72c9ae..165f416b 100644
--- a/qt/gen_qsharedmemory.go
+++ b/qt/gen_qsharedmemory.go
@@ -27,6 +27,9 @@ func (this *QSharedMemory) cPointer() *C.QSharedMemory {
 }
 
 func newQSharedMemory(h *C.QSharedMemory) *QSharedMemory {
+	if h == nil {
+		return nil
+	}
 	return &QSharedMemory{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qshortcut.go b/qt/gen_qshortcut.go
index d0bb7d11..a482491e 100644
--- a/qt/gen_qshortcut.go
+++ b/qt/gen_qshortcut.go
@@ -29,6 +29,9 @@ func (this *QShortcut) cPointer() *C.QShortcut {
 }
 
 func newQShortcut(h *C.QShortcut) *QShortcut {
+	if h == nil {
+		return nil
+	}
 	return &QShortcut{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsignalmapper.go b/qt/gen_qsignalmapper.go
index 902d0070..b3492352 100644
--- a/qt/gen_qsignalmapper.go
+++ b/qt/gen_qsignalmapper.go
@@ -28,6 +28,9 @@ func (this *QSignalMapper) cPointer() *C.QSignalMapper {
 }
 
 func newQSignalMapper(h *C.QSignalMapper) *QSignalMapper {
+	if h == nil {
+		return nil
+	}
 	return &QSignalMapper{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsignaltransition.go b/qt/gen_qsignaltransition.go
index 5ce0381b..dc1affab 100644
--- a/qt/gen_qsignaltransition.go
+++ b/qt/gen_qsignaltransition.go
@@ -28,6 +28,9 @@ func (this *QSignalTransition) cPointer() *C.QSignalTransition {
 }
 
 func newQSignalTransition(h *C.QSignalTransition) *QSignalTransition {
+	if h == nil {
+		return nil
+	}
 	return &QSignalTransition{h: h, QAbstractTransition: newQAbstractTransition_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsize.go b/qt/gen_qsize.go
index b0d97cbc..bccc6934 100644
--- a/qt/gen_qsize.go
+++ b/qt/gen_qsize.go
@@ -27,6 +27,9 @@ func (this *QSize) cPointer() *C.QSize {
 }
 
 func newQSize(h *C.QSize) *QSize {
+	if h == nil {
+		return nil
+	}
 	return &QSize{h: h}
 }
 
@@ -210,6 +213,9 @@ func (this *QSizeF) cPointer() *C.QSizeF {
 }
 
 func newQSizeF(h *C.QSizeF) *QSizeF {
+	if h == nil {
+		return nil
+	}
 	return &QSizeF{h: h}
 }
 
diff --git a/qt/gen_qsizegrip.go b/qt/gen_qsizegrip.go
index 5becde7c..3d095ddc 100644
--- a/qt/gen_qsizegrip.go
+++ b/qt/gen_qsizegrip.go
@@ -28,6 +28,9 @@ func (this *QSizeGrip) cPointer() *C.QSizeGrip {
 }
 
 func newQSizeGrip(h *C.QSizeGrip) *QSizeGrip {
+	if h == nil {
+		return nil
+	}
 	return &QSizeGrip{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsizepolicy.go b/qt/gen_qsizepolicy.go
index 209ff705..f16b2e0c 100644
--- a/qt/gen_qsizepolicy.go
+++ b/qt/gen_qsizepolicy.go
@@ -27,6 +27,9 @@ func (this *QSizePolicy) cPointer() *C.QSizePolicy {
 }
 
 func newQSizePolicy(h *C.QSizePolicy) *QSizePolicy {
+	if h == nil {
+		return nil
+	}
 	return &QSizePolicy{h: h}
 }
 
diff --git a/qt/gen_qslider.go b/qt/gen_qslider.go
index 08a7f479..b668daf8 100644
--- a/qt/gen_qslider.go
+++ b/qt/gen_qslider.go
@@ -28,6 +28,9 @@ func (this *QSlider) cPointer() *C.QSlider {
 }
 
 func newQSlider(h *C.QSlider) *QSlider {
+	if h == nil {
+		return nil
+	}
 	return &QSlider{h: h, QAbstractSlider: newQAbstractSlider_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsocketnotifier.go b/qt/gen_qsocketnotifier.go
index 2df15b5f..1caa10bd 100644
--- a/qt/gen_qsocketnotifier.go
+++ b/qt/gen_qsocketnotifier.go
@@ -27,6 +27,9 @@ func (this *QSocketNotifier) cPointer() *C.QSocketNotifier {
 }
 
 func newQSocketNotifier(h *C.QSocketNotifier) *QSocketNotifier {
+	if h == nil {
+		return nil
+	}
 	return &QSocketNotifier{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -160,6 +163,9 @@ func (this *QSocketDescriptor) cPointer() *C.QSocketDescriptor {
 }
 
 func newQSocketDescriptor(h *C.QSocketDescriptor) *QSocketDescriptor {
+	if h == nil {
+		return nil
+	}
 	return &QSocketDescriptor{h: h}
 }
 
diff --git a/qt/gen_qsortfilterproxymodel.go b/qt/gen_qsortfilterproxymodel.go
index 7933f837..f0f7ac0a 100644
--- a/qt/gen_qsortfilterproxymodel.go
+++ b/qt/gen_qsortfilterproxymodel.go
@@ -29,6 +29,9 @@ func (this *QSortFilterProxyModel) cPointer() *C.QSortFilterProxyModel {
 }
 
 func newQSortFilterProxyModel(h *C.QSortFilterProxyModel) *QSortFilterProxyModel {
+	if h == nil {
+		return nil
+	}
 	return &QSortFilterProxyModel{h: h, QAbstractProxyModel: newQAbstractProxyModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qspinbox.go b/qt/gen_qspinbox.go
index fcd571b1..2b4b4bbc 100644
--- a/qt/gen_qspinbox.go
+++ b/qt/gen_qspinbox.go
@@ -28,6 +28,9 @@ func (this *QSpinBox) cPointer() *C.QSpinBox {
 }
 
 func newQSpinBox(h *C.QSpinBox) *QSpinBox {
+	if h == nil {
+		return nil
+	}
 	return &QSpinBox{h: h, QAbstractSpinBox: newQAbstractSpinBox_U(unsafe.Pointer(h))}
 }
 
@@ -280,6 +283,9 @@ func (this *QDoubleSpinBox) cPointer() *C.QDoubleSpinBox {
 }
 
 func newQDoubleSpinBox(h *C.QDoubleSpinBox) *QDoubleSpinBox {
+	if h == nil {
+		return nil
+	}
 	return &QDoubleSpinBox{h: h, QAbstractSpinBox: newQAbstractSpinBox_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsplashscreen.go b/qt/gen_qsplashscreen.go
index 3d114e43..4ee34dae 100644
--- a/qt/gen_qsplashscreen.go
+++ b/qt/gen_qsplashscreen.go
@@ -29,6 +29,9 @@ func (this *QSplashScreen) cPointer() *C.QSplashScreen {
 }
 
 func newQSplashScreen(h *C.QSplashScreen) *QSplashScreen {
+	if h == nil {
+		return nil
+	}
 	return &QSplashScreen{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsplitter.go b/qt/gen_qsplitter.go
index 26981974..fc1d65d4 100644
--- a/qt/gen_qsplitter.go
+++ b/qt/gen_qsplitter.go
@@ -29,6 +29,9 @@ func (this *QSplitter) cPointer() *C.QSplitter {
 }
 
 func newQSplitter(h *C.QSplitter) *QSplitter {
+	if h == nil {
+		return nil
+	}
 	return &QSplitter{h: h, QFrame: newQFrame_U(unsafe.Pointer(h))}
 }
 
@@ -323,6 +326,9 @@ func (this *QSplitterHandle) cPointer() *C.QSplitterHandle {
 }
 
 func newQSplitterHandle(h *C.QSplitterHandle) *QSplitterHandle {
+	if h == nil {
+		return nil
+	}
 	return &QSplitterHandle{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstackedlayout.go b/qt/gen_qstackedlayout.go
index fcd296a2..591fd779 100644
--- a/qt/gen_qstackedlayout.go
+++ b/qt/gen_qstackedlayout.go
@@ -29,6 +29,9 @@ func (this *QStackedLayout) cPointer() *C.QStackedLayout {
 }
 
 func newQStackedLayout(h *C.QStackedLayout) *QStackedLayout {
+	if h == nil {
+		return nil
+	}
 	return &QStackedLayout{h: h, QLayout: newQLayout_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstackedwidget.go b/qt/gen_qstackedwidget.go
index f6b1a278..ea7224df 100644
--- a/qt/gen_qstackedwidget.go
+++ b/qt/gen_qstackedwidget.go
@@ -28,6 +28,9 @@ func (this *QStackedWidget) cPointer() *C.QStackedWidget {
 }
 
 func newQStackedWidget(h *C.QStackedWidget) *QStackedWidget {
+	if h == nil {
+		return nil
+	}
 	return &QStackedWidget{h: h, QFrame: newQFrame_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstandarditemmodel.go b/qt/gen_qstandarditemmodel.go
index 56d146a1..caf40f3b 100644
--- a/qt/gen_qstandarditemmodel.go
+++ b/qt/gen_qstandarditemmodel.go
@@ -28,6 +28,9 @@ func (this *QStandardItem) cPointer() *C.QStandardItem {
 }
 
 func newQStandardItem(h *C.QStandardItem) *QStandardItem {
+	if h == nil {
+		return nil
+	}
 	return &QStandardItem{h: h}
 }
 
@@ -624,6 +627,9 @@ func (this *QStandardItemModel) cPointer() *C.QStandardItemModel {
 }
 
 func newQStandardItemModel(h *C.QStandardItemModel) *QStandardItemModel {
+	if h == nil {
+		return nil
+	}
 	return &QStandardItemModel{h: h, QAbstractItemModel: newQAbstractItemModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstandardpaths.go b/qt/gen_qstandardpaths.go
index 807ec2a5..1b3a8ddd 100644
--- a/qt/gen_qstandardpaths.go
+++ b/qt/gen_qstandardpaths.go
@@ -26,6 +26,9 @@ func (this *QStandardPaths) cPointer() *C.QStandardPaths {
 }
 
 func newQStandardPaths(h *C.QStandardPaths) *QStandardPaths {
+	if h == nil {
+		return nil
+	}
 	return &QStandardPaths{h: h}
 }
 
diff --git a/qt/gen_qstate.go b/qt/gen_qstate.go
index 073ee70c..f9877344 100644
--- a/qt/gen_qstate.go
+++ b/qt/gen_qstate.go
@@ -27,6 +27,9 @@ func (this *QState) cPointer() *C.QState {
 }
 
 func newQState(h *C.QState) *QState {
+	if h == nil {
+		return nil
+	}
 	return &QState{h: h, QAbstractState: newQAbstractState_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstatemachine.go b/qt/gen_qstatemachine.go
index 0f0e296a..1d7a6cf7 100644
--- a/qt/gen_qstatemachine.go
+++ b/qt/gen_qstatemachine.go
@@ -28,6 +28,9 @@ func (this *QStateMachine) cPointer() *C.QStateMachine {
 }
 
 func newQStateMachine(h *C.QStateMachine) *QStateMachine {
+	if h == nil {
+		return nil
+	}
 	return &QStateMachine{h: h, QState: newQState_U(unsafe.Pointer(h))}
 }
 
@@ -272,6 +275,9 @@ func (this *QStateMachine__SignalEvent) cPointer() *C.QStateMachine__SignalEvent
 }
 
 func newQStateMachine__SignalEvent(h *C.QStateMachine__SignalEvent) *QStateMachine__SignalEvent {
+	if h == nil {
+		return nil
+	}
 	return &QStateMachine__SignalEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
@@ -312,6 +318,9 @@ func (this *QStateMachine__WrappedEvent) cPointer() *C.QStateMachine__WrappedEve
 }
 
 func newQStateMachine__WrappedEvent(h *C.QStateMachine__WrappedEvent) *QStateMachine__WrappedEvent {
+	if h == nil {
+		return nil
+	}
 	return &QStateMachine__WrappedEvent{h: h, QEvent: newQEvent_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstatictext.go b/qt/gen_qstatictext.go
index 6a9717ee..9d2c1da6 100644
--- a/qt/gen_qstatictext.go
+++ b/qt/gen_qstatictext.go
@@ -27,6 +27,9 @@ func (this *QStaticText) cPointer() *C.QStaticText {
 }
 
 func newQStaticText(h *C.QStaticText) *QStaticText {
+	if h == nil {
+		return nil
+	}
 	return &QStaticText{h: h}
 }
 
diff --git a/qt/gen_qstatusbar.go b/qt/gen_qstatusbar.go
index cb024799..f9a12a35 100644
--- a/qt/gen_qstatusbar.go
+++ b/qt/gen_qstatusbar.go
@@ -28,6 +28,9 @@ func (this *QStatusBar) cPointer() *C.QStatusBar {
 }
 
 func newQStatusBar(h *C.QStatusBar) *QStatusBar {
+	if h == nil {
+		return nil
+	}
 	return &QStatusBar{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstorageinfo.go b/qt/gen_qstorageinfo.go
index 703470bb..c06d695d 100644
--- a/qt/gen_qstorageinfo.go
+++ b/qt/gen_qstorageinfo.go
@@ -27,6 +27,9 @@ func (this *QStorageInfo) cPointer() *C.QStorageInfo {
 }
 
 func newQStorageInfo(h *C.QStorageInfo) *QStorageInfo {
+	if h == nil {
+		return nil
+	}
 	return &QStorageInfo{h: h}
 }
 
diff --git a/qt/gen_qstringbuilder.go b/qt/gen_qstringbuilder.go
index 1b6ecfbd..b8aeb979 100644
--- a/qt/gen_qstringbuilder.go
+++ b/qt/gen_qstringbuilder.go
@@ -26,6 +26,9 @@ func (this *QAbstractConcatenable) cPointer() *C.QAbstractConcatenable {
 }
 
 func newQAbstractConcatenable(h *C.QAbstractConcatenable) *QAbstractConcatenable {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractConcatenable{h: h}
 }
 
diff --git a/qt/gen_qstringlistmodel.go b/qt/gen_qstringlistmodel.go
index dee2f6c7..74ab5581 100644
--- a/qt/gen_qstringlistmodel.go
+++ b/qt/gen_qstringlistmodel.go
@@ -28,6 +28,9 @@ func (this *QStringListModel) cPointer() *C.QStringListModel {
 }
 
 func newQStringListModel(h *C.QStringListModel) *QStringListModel {
+	if h == nil {
+		return nil
+	}
 	return &QStringListModel{h: h, QAbstractListModel: newQAbstractListModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstringliteral.go b/qt/gen_qstringliteral.go
index 01c47f34..ac5e34df 100644
--- a/qt/gen_qstringliteral.go
+++ b/qt/gen_qstringliteral.go
@@ -26,6 +26,9 @@ func (this *QStringDataPtr) cPointer() *C.QStringDataPtr {
 }
 
 func newQStringDataPtr(h *C.QStringDataPtr) *QStringDataPtr {
+	if h == nil {
+		return nil
+	}
 	return &QStringDataPtr{h: h}
 }
 
diff --git a/qt/gen_qstringmatcher.go b/qt/gen_qstringmatcher.go
index da2d8338..1bbb8318 100644
--- a/qt/gen_qstringmatcher.go
+++ b/qt/gen_qstringmatcher.go
@@ -26,6 +26,9 @@ func (this *QStringMatcher) cPointer() *C.QStringMatcher {
 }
 
 func newQStringMatcher(h *C.QStringMatcher) *QStringMatcher {
+	if h == nil {
+		return nil
+	}
 	return &QStringMatcher{h: h}
 }
 
diff --git a/qt/gen_qstringview.go b/qt/gen_qstringview.go
index e1a16e5f..2cf445a1 100644
--- a/qt/gen_qstringview.go
+++ b/qt/gen_qstringview.go
@@ -27,6 +27,9 @@ func (this *QStringView) cPointer() *C.QStringView {
 }
 
 func newQStringView(h *C.QStringView) *QStringView {
+	if h == nil {
+		return nil
+	}
 	return &QStringView{h: h}
 }
 
diff --git a/qt/gen_qstyle.go b/qt/gen_qstyle.go
index 6bc78dea..bac4d873 100644
--- a/qt/gen_qstyle.go
+++ b/qt/gen_qstyle.go
@@ -28,6 +28,9 @@ func (this *QStyle) cPointer() *C.QStyle {
 }
 
 func newQStyle(h *C.QStyle) *QStyle {
+	if h == nil {
+		return nil
+	}
 	return &QStyle{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstyleditemdelegate.go b/qt/gen_qstyleditemdelegate.go
index f0ee879d..e19c4580 100644
--- a/qt/gen_qstyleditemdelegate.go
+++ b/qt/gen_qstyleditemdelegate.go
@@ -28,6 +28,9 @@ func (this *QStyledItemDelegate) cPointer() *C.QStyledItemDelegate {
 }
 
 func newQStyledItemDelegate(h *C.QStyledItemDelegate) *QStyledItemDelegate {
+	if h == nil {
+		return nil
+	}
 	return &QStyledItemDelegate{h: h, QAbstractItemDelegate: newQAbstractItemDelegate_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstylefactory.go b/qt/gen_qstylefactory.go
index c03b4388..13566f61 100644
--- a/qt/gen_qstylefactory.go
+++ b/qt/gen_qstylefactory.go
@@ -26,6 +26,9 @@ func (this *QStyleFactory) cPointer() *C.QStyleFactory {
 }
 
 func newQStyleFactory(h *C.QStyleFactory) *QStyleFactory {
+	if h == nil {
+		return nil
+	}
 	return &QStyleFactory{h: h}
 }
 
diff --git a/qt/gen_qstylehints.go b/qt/gen_qstylehints.go
index 61378945..24d43fc9 100644
--- a/qt/gen_qstylehints.go
+++ b/qt/gen_qstylehints.go
@@ -29,6 +29,9 @@ func (this *QStyleHints) cPointer() *C.QStyleHints {
 }
 
 func newQStyleHints(h *C.QStyleHints) *QStyleHints {
+	if h == nil {
+		return nil
+	}
 	return &QStyleHints{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstyleoption.go b/qt/gen_qstyleoption.go
index f677e334..73500a97 100644
--- a/qt/gen_qstyleoption.go
+++ b/qt/gen_qstyleoption.go
@@ -26,6 +26,9 @@ func (this *QStyleOption) cPointer() *C.QStyleOption {
 }
 
 func newQStyleOption(h *C.QStyleOption) *QStyleOption {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOption{h: h}
 }
 
@@ -86,6 +89,9 @@ func (this *QStyleOptionFocusRect) cPointer() *C.QStyleOptionFocusRect {
 }
 
 func newQStyleOptionFocusRect(h *C.QStyleOptionFocusRect) *QStyleOptionFocusRect {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionFocusRect{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -122,6 +128,9 @@ func (this *QStyleOptionFrame) cPointer() *C.QStyleOptionFrame {
 }
 
 func newQStyleOptionFrame(h *C.QStyleOptionFrame) *QStyleOptionFrame {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionFrame{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -158,6 +167,9 @@ func (this *QStyleOptionTabWidgetFrame) cPointer() *C.QStyleOptionTabWidgetFrame
 }
 
 func newQStyleOptionTabWidgetFrame(h *C.QStyleOptionTabWidgetFrame) *QStyleOptionTabWidgetFrame {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionTabWidgetFrame{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -194,6 +206,9 @@ func (this *QStyleOptionTabBarBase) cPointer() *C.QStyleOptionTabBarBase {
 }
 
 func newQStyleOptionTabBarBase(h *C.QStyleOptionTabBarBase) *QStyleOptionTabBarBase {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionTabBarBase{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -230,6 +245,9 @@ func (this *QStyleOptionHeader) cPointer() *C.QStyleOptionHeader {
 }
 
 func newQStyleOptionHeader(h *C.QStyleOptionHeader) *QStyleOptionHeader {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionHeader{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -266,6 +284,9 @@ func (this *QStyleOptionButton) cPointer() *C.QStyleOptionButton {
 }
 
 func newQStyleOptionButton(h *C.QStyleOptionButton) *QStyleOptionButton {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionButton{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -302,6 +323,9 @@ func (this *QStyleOptionTab) cPointer() *C.QStyleOptionTab {
 }
 
 func newQStyleOptionTab(h *C.QStyleOptionTab) *QStyleOptionTab {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionTab{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -338,6 +362,9 @@ func (this *QStyleOptionTabV4) cPointer() *C.QStyleOptionTabV4 {
 }
 
 func newQStyleOptionTabV4(h *C.QStyleOptionTabV4) *QStyleOptionTabV4 {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionTabV4{h: h, QStyleOptionTab: newQStyleOptionTab_U(unsafe.Pointer(h))}
 }
 
@@ -378,6 +405,9 @@ func (this *QStyleOptionToolBar) cPointer() *C.QStyleOptionToolBar {
 }
 
 func newQStyleOptionToolBar(h *C.QStyleOptionToolBar) *QStyleOptionToolBar {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionToolBar{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -414,6 +444,9 @@ func (this *QStyleOptionProgressBar) cPointer() *C.QStyleOptionProgressBar {
 }
 
 func newQStyleOptionProgressBar(h *C.QStyleOptionProgressBar) *QStyleOptionProgressBar {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionProgressBar{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -450,6 +483,9 @@ func (this *QStyleOptionMenuItem) cPointer() *C.QStyleOptionMenuItem {
 }
 
 func newQStyleOptionMenuItem(h *C.QStyleOptionMenuItem) *QStyleOptionMenuItem {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionMenuItem{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -486,6 +522,9 @@ func (this *QStyleOptionDockWidget) cPointer() *C.QStyleOptionDockWidget {
 }
 
 func newQStyleOptionDockWidget(h *C.QStyleOptionDockWidget) *QStyleOptionDockWidget {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionDockWidget{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -522,6 +561,9 @@ func (this *QStyleOptionViewItem) cPointer() *C.QStyleOptionViewItem {
 }
 
 func newQStyleOptionViewItem(h *C.QStyleOptionViewItem) *QStyleOptionViewItem {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionViewItem{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -558,6 +600,9 @@ func (this *QStyleOptionToolBox) cPointer() *C.QStyleOptionToolBox {
 }
 
 func newQStyleOptionToolBox(h *C.QStyleOptionToolBox) *QStyleOptionToolBox {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionToolBox{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -594,6 +639,9 @@ func (this *QStyleOptionRubberBand) cPointer() *C.QStyleOptionRubberBand {
 }
 
 func newQStyleOptionRubberBand(h *C.QStyleOptionRubberBand) *QStyleOptionRubberBand {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionRubberBand{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -630,6 +678,9 @@ func (this *QStyleOptionComplex) cPointer() *C.QStyleOptionComplex {
 }
 
 func newQStyleOptionComplex(h *C.QStyleOptionComplex) *QStyleOptionComplex {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionComplex{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -678,6 +729,9 @@ func (this *QStyleOptionSlider) cPointer() *C.QStyleOptionSlider {
 }
 
 func newQStyleOptionSlider(h *C.QStyleOptionSlider) *QStyleOptionSlider {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionSlider{h: h, QStyleOptionComplex: newQStyleOptionComplex_U(unsafe.Pointer(h))}
 }
 
@@ -714,6 +768,9 @@ func (this *QStyleOptionSpinBox) cPointer() *C.QStyleOptionSpinBox {
 }
 
 func newQStyleOptionSpinBox(h *C.QStyleOptionSpinBox) *QStyleOptionSpinBox {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionSpinBox{h: h, QStyleOptionComplex: newQStyleOptionComplex_U(unsafe.Pointer(h))}
 }
 
@@ -750,6 +807,9 @@ func (this *QStyleOptionToolButton) cPointer() *C.QStyleOptionToolButton {
 }
 
 func newQStyleOptionToolButton(h *C.QStyleOptionToolButton) *QStyleOptionToolButton {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionToolButton{h: h, QStyleOptionComplex: newQStyleOptionComplex_U(unsafe.Pointer(h))}
 }
 
@@ -786,6 +846,9 @@ func (this *QStyleOptionComboBox) cPointer() *C.QStyleOptionComboBox {
 }
 
 func newQStyleOptionComboBox(h *C.QStyleOptionComboBox) *QStyleOptionComboBox {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionComboBox{h: h, QStyleOptionComplex: newQStyleOptionComplex_U(unsafe.Pointer(h))}
 }
 
@@ -822,6 +885,9 @@ func (this *QStyleOptionTitleBar) cPointer() *C.QStyleOptionTitleBar {
 }
 
 func newQStyleOptionTitleBar(h *C.QStyleOptionTitleBar) *QStyleOptionTitleBar {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionTitleBar{h: h, QStyleOptionComplex: newQStyleOptionComplex_U(unsafe.Pointer(h))}
 }
 
@@ -858,6 +924,9 @@ func (this *QStyleOptionGroupBox) cPointer() *C.QStyleOptionGroupBox {
 }
 
 func newQStyleOptionGroupBox(h *C.QStyleOptionGroupBox) *QStyleOptionGroupBox {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionGroupBox{h: h, QStyleOptionComplex: newQStyleOptionComplex_U(unsafe.Pointer(h))}
 }
 
@@ -894,6 +963,9 @@ func (this *QStyleOptionSizeGrip) cPointer() *C.QStyleOptionSizeGrip {
 }
 
 func newQStyleOptionSizeGrip(h *C.QStyleOptionSizeGrip) *QStyleOptionSizeGrip {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionSizeGrip{h: h, QStyleOptionComplex: newQStyleOptionComplex_U(unsafe.Pointer(h))}
 }
 
@@ -930,6 +1002,9 @@ func (this *QStyleOptionGraphicsItem) cPointer() *C.QStyleOptionGraphicsItem {
 }
 
 func newQStyleOptionGraphicsItem(h *C.QStyleOptionGraphicsItem) *QStyleOptionGraphicsItem {
+	if h == nil {
+		return nil
+	}
 	return &QStyleOptionGraphicsItem{h: h, QStyleOption: newQStyleOption_U(unsafe.Pointer(h))}
 }
 
@@ -970,6 +1045,9 @@ func (this *QStyleHintReturn) cPointer() *C.QStyleHintReturn {
 }
 
 func newQStyleHintReturn(h *C.QStyleHintReturn) *QStyleHintReturn {
+	if h == nil {
+		return nil
+	}
 	return &QStyleHintReturn{h: h}
 }
 
@@ -1022,6 +1100,9 @@ func (this *QStyleHintReturnMask) cPointer() *C.QStyleHintReturnMask {
 }
 
 func newQStyleHintReturnMask(h *C.QStyleHintReturnMask) *QStyleHintReturnMask {
+	if h == nil {
+		return nil
+	}
 	return &QStyleHintReturnMask{h: h, QStyleHintReturn: newQStyleHintReturn_U(unsafe.Pointer(h))}
 }
 
@@ -1062,6 +1143,9 @@ func (this *QStyleHintReturnVariant) cPointer() *C.QStyleHintReturnVariant {
 }
 
 func newQStyleHintReturnVariant(h *C.QStyleHintReturnVariant) *QStyleHintReturnVariant {
+	if h == nil {
+		return nil
+	}
 	return &QStyleHintReturnVariant{h: h, QStyleHintReturn: newQStyleHintReturn_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstylepainter.go b/qt/gen_qstylepainter.go
index 86277967..b701da43 100644
--- a/qt/gen_qstylepainter.go
+++ b/qt/gen_qstylepainter.go
@@ -27,6 +27,9 @@ func (this *QStylePainter) cPointer() *C.QStylePainter {
 }
 
 func newQStylePainter(h *C.QStylePainter) *QStylePainter {
+	if h == nil {
+		return nil
+	}
 	return &QStylePainter{h: h, QPainter: newQPainter_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qstyleplugin.go b/qt/gen_qstyleplugin.go
index c673e9dc..f144611b 100644
--- a/qt/gen_qstyleplugin.go
+++ b/qt/gen_qstyleplugin.go
@@ -27,6 +27,9 @@ func (this *QStylePlugin) cPointer() *C.QStylePlugin {
 }
 
 func newQStylePlugin(h *C.QStylePlugin) *QStylePlugin {
+	if h == nil {
+		return nil
+	}
 	return &QStylePlugin{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsurface.go b/qt/gen_qsurface.go
index 8f325f03..e91b1b5f 100644
--- a/qt/gen_qsurface.go
+++ b/qt/gen_qsurface.go
@@ -27,6 +27,9 @@ func (this *QSurface) cPointer() *C.QSurface {
 }
 
 func newQSurface(h *C.QSurface) *QSurface {
+	if h == nil {
+		return nil
+	}
 	return &QSurface{h: h}
 }
 
diff --git a/qt/gen_qsurfaceformat.go b/qt/gen_qsurfaceformat.go
index e254771a..39ca3ea7 100644
--- a/qt/gen_qsurfaceformat.go
+++ b/qt/gen_qsurfaceformat.go
@@ -27,6 +27,9 @@ func (this *QSurfaceFormat) cPointer() *C.QSurfaceFormat {
 }
 
 func newQSurfaceFormat(h *C.QSurfaceFormat) *QSurfaceFormat {
+	if h == nil {
+		return nil
+	}
 	return &QSurfaceFormat{h: h}
 }
 
diff --git a/qt/gen_qsyntaxhighlighter.go b/qt/gen_qsyntaxhighlighter.go
index b800ed2a..f2309553 100644
--- a/qt/gen_qsyntaxhighlighter.go
+++ b/qt/gen_qsyntaxhighlighter.go
@@ -27,6 +27,9 @@ func (this *QSyntaxHighlighter) cPointer() *C.QSyntaxHighlighter {
 }
 
 func newQSyntaxHighlighter(h *C.QSyntaxHighlighter) *QSyntaxHighlighter {
+	if h == nil {
+		return nil
+	}
 	return &QSyntaxHighlighter{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qsystemsemaphore.go b/qt/gen_qsystemsemaphore.go
index 71e6907a..651981a1 100644
--- a/qt/gen_qsystemsemaphore.go
+++ b/qt/gen_qsystemsemaphore.go
@@ -26,6 +26,9 @@ func (this *QSystemSemaphore) cPointer() *C.QSystemSemaphore {
 }
 
 func newQSystemSemaphore(h *C.QSystemSemaphore) *QSystemSemaphore {
+	if h == nil {
+		return nil
+	}
 	return &QSystemSemaphore{h: h}
 }
 
diff --git a/qt/gen_qsystemtrayicon.go b/qt/gen_qsystemtrayicon.go
index a2542f4b..355317c4 100644
--- a/qt/gen_qsystemtrayicon.go
+++ b/qt/gen_qsystemtrayicon.go
@@ -29,6 +29,9 @@ func (this *QSystemTrayIcon) cPointer() *C.QSystemTrayIcon {
 }
 
 func newQSystemTrayIcon(h *C.QSystemTrayIcon) *QSystemTrayIcon {
+	if h == nil {
+		return nil
+	}
 	return &QSystemTrayIcon{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtabbar.go b/qt/gen_qtabbar.go
index ef0bc669..0140d64d 100644
--- a/qt/gen_qtabbar.go
+++ b/qt/gen_qtabbar.go
@@ -29,6 +29,9 @@ func (this *QTabBar) cPointer() *C.QTabBar {
 }
 
 func newQTabBar(h *C.QTabBar) *QTabBar {
+	if h == nil {
+		return nil
+	}
 	return &QTabBar{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtableview.go b/qt/gen_qtableview.go
index fc3f5aeb..6ebe5b1b 100644
--- a/qt/gen_qtableview.go
+++ b/qt/gen_qtableview.go
@@ -28,6 +28,9 @@ func (this *QTableView) cPointer() *C.QTableView {
 }
 
 func newQTableView(h *C.QTableView) *QTableView {
+	if h == nil {
+		return nil
+	}
 	return &QTableView{h: h, QAbstractItemView: newQAbstractItemView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtablewidget.go b/qt/gen_qtablewidget.go
index 7c5084a1..640dc759 100644
--- a/qt/gen_qtablewidget.go
+++ b/qt/gen_qtablewidget.go
@@ -28,6 +28,9 @@ func (this *QTableWidgetSelectionRange) cPointer() *C.QTableWidgetSelectionRange
 }
 
 func newQTableWidgetSelectionRange(h *C.QTableWidgetSelectionRange) *QTableWidgetSelectionRange {
+	if h == nil {
+		return nil
+	}
 	return &QTableWidgetSelectionRange{h: h}
 }
 
@@ -103,6 +106,9 @@ func (this *QTableWidgetItem) cPointer() *C.QTableWidgetItem {
 }
 
 func newQTableWidgetItem(h *C.QTableWidgetItem) *QTableWidgetItem {
+	if h == nil {
+		return nil
+	}
 	return &QTableWidgetItem{h: h}
 }
 
@@ -435,6 +441,9 @@ func (this *QTableWidget) cPointer() *C.QTableWidget {
 }
 
 func newQTableWidget(h *C.QTableWidget) *QTableWidget {
+	if h == nil {
+		return nil
+	}
 	return &QTableWidget{h: h, QTableView: newQTableView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtabwidget.go b/qt/gen_qtabwidget.go
index 74284bd8..8cac065d 100644
--- a/qt/gen_qtabwidget.go
+++ b/qt/gen_qtabwidget.go
@@ -29,6 +29,9 @@ func (this *QTabWidget) cPointer() *C.QTabWidget {
 }
 
 func newQTabWidget(h *C.QTabWidget) *QTabWidget {
+	if h == nil {
+		return nil
+	}
 	return &QTabWidget{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtemporarydir.go b/qt/gen_qtemporarydir.go
index 59a1f332..8d50f2ae 100644
--- a/qt/gen_qtemporarydir.go
+++ b/qt/gen_qtemporarydir.go
@@ -26,6 +26,9 @@ func (this *QTemporaryDir) cPointer() *C.QTemporaryDir {
 }
 
 func newQTemporaryDir(h *C.QTemporaryDir) *QTemporaryDir {
+	if h == nil {
+		return nil
+	}
 	return &QTemporaryDir{h: h}
 }
 
diff --git a/qt/gen_qtemporaryfile.go b/qt/gen_qtemporaryfile.go
index 5746e38e..54b742a1 100644
--- a/qt/gen_qtemporaryfile.go
+++ b/qt/gen_qtemporaryfile.go
@@ -27,6 +27,9 @@ func (this *QTemporaryFile) cPointer() *C.QTemporaryFile {
 }
 
 func newQTemporaryFile(h *C.QTemporaryFile) *QTemporaryFile {
+	if h == nil {
+		return nil
+	}
 	return &QTemporaryFile{h: h, QFile: newQFile_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtextboundaryfinder.go b/qt/gen_qtextboundaryfinder.go
index 1e62068c..d442942a 100644
--- a/qt/gen_qtextboundaryfinder.go
+++ b/qt/gen_qtextboundaryfinder.go
@@ -26,6 +26,9 @@ func (this *QTextBoundaryFinder) cPointer() *C.QTextBoundaryFinder {
 }
 
 func newQTextBoundaryFinder(h *C.QTextBoundaryFinder) *QTextBoundaryFinder {
+	if h == nil {
+		return nil
+	}
 	return &QTextBoundaryFinder{h: h}
 }
 
diff --git a/qt/gen_qtextbrowser.go b/qt/gen_qtextbrowser.go
index 4490a5fb..ab9a11bb 100644
--- a/qt/gen_qtextbrowser.go
+++ b/qt/gen_qtextbrowser.go
@@ -29,6 +29,9 @@ func (this *QTextBrowser) cPointer() *C.QTextBrowser {
 }
 
 func newQTextBrowser(h *C.QTextBrowser) *QTextBrowser {
+	if h == nil {
+		return nil
+	}
 	return &QTextBrowser{h: h, QTextEdit: newQTextEdit_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtextcodec.go b/qt/gen_qtextcodec.go
index a4484f10..d8fa5dcd 100644
--- a/qt/gen_qtextcodec.go
+++ b/qt/gen_qtextcodec.go
@@ -27,6 +27,9 @@ func (this *QTextCodec) cPointer() *C.QTextCodec {
 }
 
 func newQTextCodec(h *C.QTextCodec) *QTextCodec {
+	if h == nil {
+		return nil
+	}
 	return &QTextCodec{h: h}
 }
 
@@ -256,6 +259,9 @@ func (this *QTextEncoder) cPointer() *C.QTextEncoder {
 }
 
 func newQTextEncoder(h *C.QTextEncoder) *QTextEncoder {
+	if h == nil {
+		return nil
+	}
 	return &QTextEncoder{h: h}
 }
 
@@ -320,6 +326,9 @@ func (this *QTextDecoder) cPointer() *C.QTextDecoder {
 }
 
 func newQTextDecoder(h *C.QTextDecoder) *QTextDecoder {
+	if h == nil {
+		return nil
+	}
 	return &QTextDecoder{h: h}
 }
 
@@ -385,6 +394,9 @@ func (this *QTextCodec__ConverterState) cPointer() *C.QTextCodec__ConverterState
 }
 
 func newQTextCodec__ConverterState(h *C.QTextCodec__ConverterState) *QTextCodec__ConverterState {
+	if h == nil {
+		return nil
+	}
 	return &QTextCodec__ConverterState{h: h}
 }
 
diff --git a/qt/gen_qtextcursor.go b/qt/gen_qtextcursor.go
index 8b52257e..6fc6476a 100644
--- a/qt/gen_qtextcursor.go
+++ b/qt/gen_qtextcursor.go
@@ -27,6 +27,9 @@ func (this *QTextCursor) cPointer() *C.QTextCursor {
 }
 
 func newQTextCursor(h *C.QTextCursor) *QTextCursor {
+	if h == nil {
+		return nil
+	}
 	return &QTextCursor{h: h}
 }
 
diff --git a/qt/gen_qtextdocument.go b/qt/gen_qtextdocument.go
index c67d6007..4e3fe027 100644
--- a/qt/gen_qtextdocument.go
+++ b/qt/gen_qtextdocument.go
@@ -28,6 +28,9 @@ func (this *QAbstractUndoItem) cPointer() *C.QAbstractUndoItem {
 }
 
 func newQAbstractUndoItem(h *C.QAbstractUndoItem) *QAbstractUndoItem {
+	if h == nil {
+		return nil
+	}
 	return &QAbstractUndoItem{h: h}
 }
 
@@ -60,6 +63,9 @@ func (this *QTextDocument) cPointer() *C.QTextDocument {
 }
 
 func newQTextDocument(h *C.QTextDocument) *QTextDocument {
+	if h == nil {
+		return nil
+	}
 	return &QTextDocument{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtextdocumentfragment.go b/qt/gen_qtextdocumentfragment.go
index 63860b53..565f0170 100644
--- a/qt/gen_qtextdocumentfragment.go
+++ b/qt/gen_qtextdocumentfragment.go
@@ -27,6 +27,9 @@ func (this *QTextDocumentFragment) cPointer() *C.QTextDocumentFragment {
 }
 
 func newQTextDocumentFragment(h *C.QTextDocumentFragment) *QTextDocumentFragment {
+	if h == nil {
+		return nil
+	}
 	return &QTextDocumentFragment{h: h}
 }
 
diff --git a/qt/gen_qtextdocumentwriter.go b/qt/gen_qtextdocumentwriter.go
index ed0a69ec..d67b23aa 100644
--- a/qt/gen_qtextdocumentwriter.go
+++ b/qt/gen_qtextdocumentwriter.go
@@ -27,6 +27,9 @@ func (this *QTextDocumentWriter) cPointer() *C.QTextDocumentWriter {
 }
 
 func newQTextDocumentWriter(h *C.QTextDocumentWriter) *QTextDocumentWriter {
+	if h == nil {
+		return nil
+	}
 	return &QTextDocumentWriter{h: h}
 }
 
diff --git a/qt/gen_qtextedit.go b/qt/gen_qtextedit.go
index 1849abb9..6152d2b8 100644
--- a/qt/gen_qtextedit.go
+++ b/qt/gen_qtextedit.go
@@ -29,6 +29,9 @@ func (this *QTextEdit) cPointer() *C.QTextEdit {
 }
 
 func newQTextEdit(h *C.QTextEdit) *QTextEdit {
+	if h == nil {
+		return nil
+	}
 	return &QTextEdit{h: h, QAbstractScrollArea: newQAbstractScrollArea_U(unsafe.Pointer(h))}
 }
 
@@ -829,6 +832,9 @@ func (this *QTextEdit__ExtraSelection) cPointer() *C.QTextEdit__ExtraSelection {
 }
 
 func newQTextEdit__ExtraSelection(h *C.QTextEdit__ExtraSelection) *QTextEdit__ExtraSelection {
+	if h == nil {
+		return nil
+	}
 	return &QTextEdit__ExtraSelection{h: h}
 }
 
diff --git a/qt/gen_qtextformat.go b/qt/gen_qtextformat.go
index 5b06ec04..b2a0355d 100644
--- a/qt/gen_qtextformat.go
+++ b/qt/gen_qtextformat.go
@@ -27,6 +27,9 @@ func (this *QTextLength) cPointer() *C.QTextLength {
 }
 
 func newQTextLength(h *C.QTextLength) *QTextLength {
+	if h == nil {
+		return nil
+	}
 	return &QTextLength{h: h}
 }
 
@@ -93,6 +96,9 @@ func (this *QTextFormat) cPointer() *C.QTextFormat {
 }
 
 func newQTextFormat(h *C.QTextFormat) *QTextFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextFormat{h: h}
 }
 
@@ -469,6 +475,9 @@ func (this *QTextCharFormat) cPointer() *C.QTextCharFormat {
 }
 
 func newQTextCharFormat(h *C.QTextCharFormat) *QTextCharFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextCharFormat{h: h, QTextFormat: newQTextFormat_U(unsafe.Pointer(h))}
 }
 
@@ -885,6 +894,9 @@ func (this *QTextBlockFormat) cPointer() *C.QTextBlockFormat {
 }
 
 func newQTextBlockFormat(h *C.QTextBlockFormat) *QTextBlockFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextBlockFormat{h: h, QTextFormat: newQTextFormat_U(unsafe.Pointer(h))}
 }
 
@@ -1067,6 +1079,9 @@ func (this *QTextListFormat) cPointer() *C.QTextListFormat {
 }
 
 func newQTextListFormat(h *C.QTextListFormat) *QTextListFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextListFormat{h: h, QTextFormat: newQTextFormat_U(unsafe.Pointer(h))}
 }
 
@@ -1156,6 +1171,9 @@ func (this *QTextImageFormat) cPointer() *C.QTextImageFormat {
 }
 
 func newQTextImageFormat(h *C.QTextImageFormat) *QTextImageFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextImageFormat{h: h, QTextCharFormat: newQTextCharFormat_U(unsafe.Pointer(h))}
 }
 
@@ -1237,6 +1255,9 @@ func (this *QTextFrameFormat) cPointer() *C.QTextFrameFormat {
 }
 
 func newQTextFrameFormat(h *C.QTextFrameFormat) *QTextFrameFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextFrameFormat{h: h, QTextFormat: newQTextFormat_U(unsafe.Pointer(h))}
 }
 
@@ -1421,6 +1442,9 @@ func (this *QTextTableFormat) cPointer() *C.QTextTableFormat {
 }
 
 func newQTextTableFormat(h *C.QTextTableFormat) *QTextTableFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextTableFormat{h: h, QTextFrameFormat: newQTextFrameFormat_U(unsafe.Pointer(h))}
 }
 
@@ -1537,6 +1561,9 @@ func (this *QTextTableCellFormat) cPointer() *C.QTextTableCellFormat {
 }
 
 func newQTextTableCellFormat(h *C.QTextTableCellFormat) *QTextTableCellFormat {
+	if h == nil {
+		return nil
+	}
 	return &QTextTableCellFormat{h: h, QTextCharFormat: newQTextCharFormat_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtextlayout.go b/qt/gen_qtextlayout.go
index a63f4cd9..8b5c4f40 100644
--- a/qt/gen_qtextlayout.go
+++ b/qt/gen_qtextlayout.go
@@ -27,6 +27,9 @@ func (this *QTextInlineObject) cPointer() *C.QTextInlineObject {
 }
 
 func newQTextInlineObject(h *C.QTextInlineObject) *QTextInlineObject {
+	if h == nil {
+		return nil
+	}
 	return &QTextInlineObject{h: h}
 }
 
@@ -130,6 +133,9 @@ func (this *QTextLayout) cPointer() *C.QTextLayout {
 }
 
 func newQTextLayout(h *C.QTextLayout) *QTextLayout {
+	if h == nil {
+		return nil
+	}
 	return &QTextLayout{h: h}
 }
 
@@ -520,6 +526,9 @@ func (this *QTextLine) cPointer() *C.QTextLine {
 }
 
 func newQTextLine(h *C.QTextLine) *QTextLine {
+	if h == nil {
+		return nil
+	}
 	return &QTextLine{h: h}
 }
 
@@ -749,6 +758,9 @@ func (this *QTextLayout__FormatRange) cPointer() *C.QTextLayout__FormatRange {
 }
 
 func newQTextLayout__FormatRange(h *C.QTextLayout__FormatRange) *QTextLayout__FormatRange {
+	if h == nil {
+		return nil
+	}
 	return &QTextLayout__FormatRange{h: h}
 }
 
diff --git a/qt/gen_qtextlist.go b/qt/gen_qtextlist.go
index 543e4da2..ddb488bb 100644
--- a/qt/gen_qtextlist.go
+++ b/qt/gen_qtextlist.go
@@ -28,6 +28,9 @@ func (this *QTextList) cPointer() *C.QTextList {
 }
 
 func newQTextList(h *C.QTextList) *QTextList {
+	if h == nil {
+		return nil
+	}
 	return &QTextList{h: h, QTextBlockGroup: newQTextBlockGroup_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtextobject.go b/qt/gen_qtextobject.go
index c6fd2075..2aeb4cf9 100644
--- a/qt/gen_qtextobject.go
+++ b/qt/gen_qtextobject.go
@@ -28,6 +28,9 @@ func (this *QTextObject) cPointer() *C.QTextObject {
 }
 
 func newQTextObject(h *C.QTextObject) *QTextObject {
+	if h == nil {
+		return nil
+	}
 	return &QTextObject{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -153,6 +156,9 @@ func (this *QTextBlockGroup) cPointer() *C.QTextBlockGroup {
 }
 
 func newQTextBlockGroup(h *C.QTextBlockGroup) *QTextBlockGroup {
+	if h == nil {
+		return nil
+	}
 	return &QTextBlockGroup{h: h, QTextObject: newQTextObject_U(unsafe.Pointer(h))}
 }
 
@@ -251,6 +257,9 @@ func (this *QTextFrameLayoutData) cPointer() *C.QTextFrameLayoutData {
 }
 
 func newQTextFrameLayoutData(h *C.QTextFrameLayoutData) *QTextFrameLayoutData {
+	if h == nil {
+		return nil
+	}
 	return &QTextFrameLayoutData{h: h}
 }
 
@@ -279,6 +288,9 @@ func (this *QTextFrame) cPointer() *C.QTextFrame {
 }
 
 func newQTextFrame(h *C.QTextFrame) *QTextFrame {
+	if h == nil {
+		return nil
+	}
 	return &QTextFrame{h: h, QTextObject: newQTextObject_U(unsafe.Pointer(h))}
 }
 
@@ -483,6 +495,9 @@ func (this *QTextBlockUserData) cPointer() *C.QTextBlockUserData {
 }
 
 func newQTextBlockUserData(h *C.QTextBlockUserData) *QTextBlockUserData {
+	if h == nil {
+		return nil
+	}
 	return &QTextBlockUserData{h: h}
 }
 
@@ -510,6 +525,9 @@ func (this *QTextBlock) cPointer() *C.QTextBlock {
 }
 
 func newQTextBlock(h *C.QTextBlock) *QTextBlock {
+	if h == nil {
+		return nil
+	}
 	return &QTextBlock{h: h}
 }
 
@@ -766,6 +784,9 @@ func (this *QTextFragment) cPointer() *C.QTextFragment {
 }
 
 func newQTextFragment(h *C.QTextFragment) *QTextFragment {
+	if h == nil {
+		return nil
+	}
 	return &QTextFragment{h: h}
 }
 
@@ -904,6 +925,9 @@ func (this *QTextFrame__iterator) cPointer() *C.QTextFrame__iterator {
 }
 
 func newQTextFrame__iterator(h *C.QTextFrame__iterator) *QTextFrame__iterator {
+	if h == nil {
+		return nil
+	}
 	return &QTextFrame__iterator{h: h}
 }
 
@@ -997,6 +1021,9 @@ func (this *QTextBlock__iterator) cPointer() *C.QTextBlock__iterator {
 }
 
 func newQTextBlock__iterator(h *C.QTextBlock__iterator) *QTextBlock__iterator {
+	if h == nil {
+		return nil
+	}
 	return &QTextBlock__iterator{h: h}
 }
 
diff --git a/qt/gen_qtextoption.go b/qt/gen_qtextoption.go
index 6a5256f3..4282ae7e 100644
--- a/qt/gen_qtextoption.go
+++ b/qt/gen_qtextoption.go
@@ -26,6 +26,9 @@ func (this *QTextOption) cPointer() *C.QTextOption {
 }
 
 func newQTextOption(h *C.QTextOption) *QTextOption {
+	if h == nil {
+		return nil
+	}
 	return &QTextOption{h: h}
 }
 
@@ -180,6 +183,9 @@ func (this *QTextOption__Tab) cPointer() *C.QTextOption__Tab {
 }
 
 func newQTextOption__Tab(h *C.QTextOption__Tab) *QTextOption__Tab {
+	if h == nil {
+		return nil
+	}
 	return &QTextOption__Tab{h: h}
 }
 
diff --git a/qt/gen_qtextstream.go b/qt/gen_qtextstream.go
index bf4f3a39..e56d138f 100644
--- a/qt/gen_qtextstream.go
+++ b/qt/gen_qtextstream.go
@@ -27,6 +27,9 @@ func (this *QTextStream) cPointer() *C.QTextStream {
 }
 
 func newQTextStream(h *C.QTextStream) *QTextStream {
+	if h == nil {
+		return nil
+	}
 	return &QTextStream{h: h}
 }
 
diff --git a/qt/gen_qtexttable.go b/qt/gen_qtexttable.go
index 939c548e..ce771787 100644
--- a/qt/gen_qtexttable.go
+++ b/qt/gen_qtexttable.go
@@ -27,6 +27,9 @@ func (this *QTextTableCell) cPointer() *C.QTextTableCell {
 }
 
 func newQTextTableCell(h *C.QTextTableCell) *QTextTableCell {
+	if h == nil {
+		return nil
+	}
 	return &QTextTableCell{h: h}
 }
 
@@ -176,6 +179,9 @@ func (this *QTextTable) cPointer() *C.QTextTable {
 }
 
 func newQTextTable(h *C.QTextTable) *QTextTable {
+	if h == nil {
+		return nil
+	}
 	return &QTextTable{h: h, QTextFrame: newQTextFrame_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qthread.go b/qt/gen_qthread.go
index 8256f7ab..d0d16fe4 100644
--- a/qt/gen_qthread.go
+++ b/qt/gen_qthread.go
@@ -27,6 +27,9 @@ func (this *QThread) cPointer() *C.QThread {
 }
 
 func newQThread(h *C.QThread) *QThread {
+	if h == nil {
+		return nil
+	}
 	return &QThread{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qthreadpool.go b/qt/gen_qthreadpool.go
index c6911e12..bae73fad 100644
--- a/qt/gen_qthreadpool.go
+++ b/qt/gen_qthreadpool.go
@@ -27,6 +27,9 @@ func (this *QThreadPool) cPointer() *C.QThreadPool {
 }
 
 func newQThreadPool(h *C.QThreadPool) *QThreadPool {
+	if h == nil {
+		return nil
+	}
 	return &QThreadPool{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qthreadstorage.go b/qt/gen_qthreadstorage.go
index 5ea92f88..3e400866 100644
--- a/qt/gen_qthreadstorage.go
+++ b/qt/gen_qthreadstorage.go
@@ -26,6 +26,9 @@ func (this *QThreadStorageData) cPointer() *C.QThreadStorageData {
 }
 
 func newQThreadStorageData(h *C.QThreadStorageData) *QThreadStorageData {
+	if h == nil {
+		return nil
+	}
 	return &QThreadStorageData{h: h}
 }
 
diff --git a/qt/gen_qtimeline.go b/qt/gen_qtimeline.go
index 5b809d13..89a8a7ef 100644
--- a/qt/gen_qtimeline.go
+++ b/qt/gen_qtimeline.go
@@ -28,6 +28,9 @@ func (this *QTimeLine) cPointer() *C.QTimeLine {
 }
 
 func newQTimeLine(h *C.QTimeLine) *QTimeLine {
+	if h == nil {
+		return nil
+	}
 	return &QTimeLine{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtimer.go b/qt/gen_qtimer.go
index 37f53293..8d7ce99a 100644
--- a/qt/gen_qtimer.go
+++ b/qt/gen_qtimer.go
@@ -27,6 +27,9 @@ func (this *QTimer) cPointer() *C.QTimer {
 }
 
 func newQTimer(h *C.QTimer) *QTimer {
+	if h == nil {
+		return nil
+	}
 	return &QTimer{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtimezone.go b/qt/gen_qtimezone.go
index 3f0ad833..c5614aaa 100644
--- a/qt/gen_qtimezone.go
+++ b/qt/gen_qtimezone.go
@@ -27,6 +27,9 @@ func (this *QTimeZone) cPointer() *C.QTimeZone {
 }
 
 func newQTimeZone(h *C.QTimeZone) *QTimeZone {
+	if h == nil {
+		return nil
+	}
 	return &QTimeZone{h: h}
 }
 
@@ -429,6 +432,9 @@ func (this *QTimeZone__OffsetData) cPointer() *C.QTimeZone__OffsetData {
 }
 
 func newQTimeZone__OffsetData(h *C.QTimeZone__OffsetData) *QTimeZone__OffsetData {
+	if h == nil {
+		return nil
+	}
 	return &QTimeZone__OffsetData{h: h}
 }
 
diff --git a/qt/gen_qtoolbar.go b/qt/gen_qtoolbar.go
index bf5ce63d..fa06f95b 100644
--- a/qt/gen_qtoolbar.go
+++ b/qt/gen_qtoolbar.go
@@ -29,6 +29,9 @@ func (this *QToolBar) cPointer() *C.QToolBar {
 }
 
 func newQToolBar(h *C.QToolBar) *QToolBar {
+	if h == nil {
+		return nil
+	}
 	return &QToolBar{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtoolbox.go b/qt/gen_qtoolbox.go
index 76ef3fa2..1cd7ff26 100644
--- a/qt/gen_qtoolbox.go
+++ b/qt/gen_qtoolbox.go
@@ -29,6 +29,9 @@ func (this *QToolBox) cPointer() *C.QToolBox {
 }
 
 func newQToolBox(h *C.QToolBox) *QToolBox {
+	if h == nil {
+		return nil
+	}
 	return &QToolBox{h: h, QFrame: newQFrame_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtoolbutton.go b/qt/gen_qtoolbutton.go
index afc645a8..4047d742 100644
--- a/qt/gen_qtoolbutton.go
+++ b/qt/gen_qtoolbutton.go
@@ -29,6 +29,9 @@ func (this *QToolButton) cPointer() *C.QToolButton {
 }
 
 func newQToolButton(h *C.QToolButton) *QToolButton {
+	if h == nil {
+		return nil
+	}
 	return &QToolButton{h: h, QAbstractButton: newQAbstractButton_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtooltip.go b/qt/gen_qtooltip.go
index ace48100..100dd79a 100644
--- a/qt/gen_qtooltip.go
+++ b/qt/gen_qtooltip.go
@@ -27,6 +27,9 @@ func (this *QToolTip) cPointer() *C.QToolTip {
 }
 
 func newQToolTip(h *C.QToolTip) *QToolTip {
+	if h == nil {
+		return nil
+	}
 	return &QToolTip{h: h}
 }
 
diff --git a/qt/gen_qtouchdevice.go b/qt/gen_qtouchdevice.go
index c5cf2277..ffb188d5 100644
--- a/qt/gen_qtouchdevice.go
+++ b/qt/gen_qtouchdevice.go
@@ -26,6 +26,9 @@ func (this *QTouchDevice) cPointer() *C.QTouchDevice {
 }
 
 func newQTouchDevice(h *C.QTouchDevice) *QTouchDevice {
+	if h == nil {
+		return nil
+	}
 	return &QTouchDevice{h: h}
 }
 
diff --git a/qt/gen_qtransform.go b/qt/gen_qtransform.go
index ac4bf3d5..b6b56ed4 100644
--- a/qt/gen_qtransform.go
+++ b/qt/gen_qtransform.go
@@ -27,6 +27,9 @@ func (this *QTransform) cPointer() *C.QTransform {
 }
 
 func newQTransform(h *C.QTransform) *QTransform {
+	if h == nil {
+		return nil
+	}
 	return &QTransform{h: h}
 }
 
diff --git a/qt/gen_qtranslator.go b/qt/gen_qtranslator.go
index e746a061..a3d2a472 100644
--- a/qt/gen_qtranslator.go
+++ b/qt/gen_qtranslator.go
@@ -27,6 +27,9 @@ func (this *QTranslator) cPointer() *C.QTranslator {
 }
 
 func newQTranslator(h *C.QTranslator) *QTranslator {
+	if h == nil {
+		return nil
+	}
 	return &QTranslator{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtransposeproxymodel.go b/qt/gen_qtransposeproxymodel.go
index bc650a3b..6636de33 100644
--- a/qt/gen_qtransposeproxymodel.go
+++ b/qt/gen_qtransposeproxymodel.go
@@ -28,6 +28,9 @@ func (this *QTransposeProxyModel) cPointer() *C.QTransposeProxyModel {
 }
 
 func newQTransposeProxyModel(h *C.QTransposeProxyModel) *QTransposeProxyModel {
+	if h == nil {
+		return nil
+	}
 	return &QTransposeProxyModel{h: h, QAbstractProxyModel: newQAbstractProxyModel_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtreeview.go b/qt/gen_qtreeview.go
index 9ba94645..0ea444ba 100644
--- a/qt/gen_qtreeview.go
+++ b/qt/gen_qtreeview.go
@@ -29,6 +29,9 @@ func (this *QTreeView) cPointer() *C.QTreeView {
 }
 
 func newQTreeView(h *C.QTreeView) *QTreeView {
+	if h == nil {
+		return nil
+	}
 	return &QTreeView{h: h, QAbstractItemView: newQAbstractItemView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtreewidget.go b/qt/gen_qtreewidget.go
index 77578454..bad4abaf 100644
--- a/qt/gen_qtreewidget.go
+++ b/qt/gen_qtreewidget.go
@@ -28,6 +28,9 @@ func (this *QTreeWidgetItem) cPointer() *C.QTreeWidgetItem {
 }
 
 func newQTreeWidgetItem(h *C.QTreeWidgetItem) *QTreeWidgetItem {
+	if h == nil {
+		return nil
+	}
 	return &QTreeWidgetItem{h: h}
 }
 
@@ -592,6 +595,9 @@ func (this *QTreeWidget) cPointer() *C.QTreeWidget {
 }
 
 func newQTreeWidget(h *C.QTreeWidget) *QTreeWidget {
+	if h == nil {
+		return nil
+	}
 	return &QTreeWidget{h: h, QTreeView: newQTreeView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qtreewidgetitemiterator.go b/qt/gen_qtreewidgetitemiterator.go
index a335b784..84d7f63e 100644
--- a/qt/gen_qtreewidgetitemiterator.go
+++ b/qt/gen_qtreewidgetitemiterator.go
@@ -27,6 +27,9 @@ func (this *QTreeWidgetItemIterator) cPointer() *C.QTreeWidgetItemIterator {
 }
 
 func newQTreeWidgetItemIterator(h *C.QTreeWidgetItemIterator) *QTreeWidgetItemIterator {
+	if h == nil {
+		return nil
+	}
 	return &QTreeWidgetItemIterator{h: h}
 }
 
diff --git a/qt/gen_qundogroup.go b/qt/gen_qundogroup.go
index 105c9d72..8f3ee2ee 100644
--- a/qt/gen_qundogroup.go
+++ b/qt/gen_qundogroup.go
@@ -28,6 +28,9 @@ func (this *QUndoGroup) cPointer() *C.QUndoGroup {
 }
 
 func newQUndoGroup(h *C.QUndoGroup) *QUndoGroup {
+	if h == nil {
+		return nil
+	}
 	return &QUndoGroup{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qundostack.go b/qt/gen_qundostack.go
index bcb2d5d2..25b3152c 100644
--- a/qt/gen_qundostack.go
+++ b/qt/gen_qundostack.go
@@ -27,6 +27,9 @@ func (this *QUndoCommand) cPointer() *C.QUndoCommand {
 }
 
 func newQUndoCommand(h *C.QUndoCommand) *QUndoCommand {
+	if h == nil {
+		return nil
+	}
 	return &QUndoCommand{h: h}
 }
 
@@ -140,6 +143,9 @@ func (this *QUndoStack) cPointer() *C.QUndoStack {
 }
 
 func newQUndoStack(h *C.QUndoStack) *QUndoStack {
+	if h == nil {
+		return nil
+	}
 	return &QUndoStack{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qundoview.go b/qt/gen_qundoview.go
index 590398a4..c99714cd 100644
--- a/qt/gen_qundoview.go
+++ b/qt/gen_qundoview.go
@@ -28,6 +28,9 @@ func (this *QUndoView) cPointer() *C.QUndoView {
 }
 
 func newQUndoView(h *C.QUndoView) *QUndoView {
+	if h == nil {
+		return nil
+	}
 	return &QUndoView{h: h, QListView: newQListView_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qurl.go b/qt/gen_qurl.go
index f4605c27..eb950bce 100644
--- a/qt/gen_qurl.go
+++ b/qt/gen_qurl.go
@@ -27,6 +27,9 @@ func (this *QUrl) cPointer() *C.QUrl {
 }
 
 func newQUrl(h *C.QUrl) *QUrl {
+	if h == nil {
+		return nil
+	}
 	return &QUrl{h: h}
 }
 
diff --git a/qt/gen_qurlquery.go b/qt/gen_qurlquery.go
index 8cb563b9..edc69e16 100644
--- a/qt/gen_qurlquery.go
+++ b/qt/gen_qurlquery.go
@@ -27,6 +27,9 @@ func (this *QUrlQuery) cPointer() *C.QUrlQuery {
 }
 
 func newQUrlQuery(h *C.QUrlQuery) *QUrlQuery {
+	if h == nil {
+		return nil
+	}
 	return &QUrlQuery{h: h}
 }
 
diff --git a/qt/gen_quuid.go b/qt/gen_quuid.go
index b77ff63a..f857e888 100644
--- a/qt/gen_quuid.go
+++ b/qt/gen_quuid.go
@@ -27,6 +27,9 @@ func (this *QUuid) cPointer() *C.QUuid {
 }
 
 func newQUuid(h *C.QUuid) *QUuid {
+	if h == nil {
+		return nil
+	}
 	return &QUuid{h: h}
 }
 
diff --git a/qt/gen_qvalidator.go b/qt/gen_qvalidator.go
index bbddecca..ea5b61ce 100644
--- a/qt/gen_qvalidator.go
+++ b/qt/gen_qvalidator.go
@@ -29,6 +29,9 @@ func (this *QValidator) cPointer() *C.QValidator {
 }
 
 func newQValidator(h *C.QValidator) *QValidator {
+	if h == nil {
+		return nil
+	}
 	return &QValidator{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
 }
 
@@ -172,6 +175,9 @@ func (this *QIntValidator) cPointer() *C.QIntValidator {
 }
 
 func newQIntValidator(h *C.QIntValidator) *QIntValidator {
+	if h == nil {
+		return nil
+	}
 	return &QIntValidator{h: h, QValidator: newQValidator_U(unsafe.Pointer(h))}
 }
 
@@ -358,6 +364,9 @@ func (this *QDoubleValidator) cPointer() *C.QDoubleValidator {
 }
 
 func newQDoubleValidator(h *C.QDoubleValidator) *QDoubleValidator {
+	if h == nil {
+		return nil
+	}
 	return &QDoubleValidator{h: h, QValidator: newQValidator_U(unsafe.Pointer(h))}
 }
 
@@ -584,6 +593,9 @@ func (this *QRegExpValidator) cPointer() *C.QRegExpValidator {
 }
 
 func newQRegExpValidator(h *C.QRegExpValidator) *QRegExpValidator {
+	if h == nil {
+		return nil
+	}
 	return &QRegExpValidator{h: h, QValidator: newQValidator_U(unsafe.Pointer(h))}
 }
 
@@ -739,6 +751,9 @@ func (this *QRegularExpressionValidator) cPointer() *C.QRegularExpressionValidat
 }
 
 func newQRegularExpressionValidator(h *C.QRegularExpressionValidator) *QRegularExpressionValidator {
+	if h == nil {
+		return nil
+	}
 	return &QRegularExpressionValidator{h: h, QValidator: newQValidator_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qvariant.go b/qt/gen_qvariant.go
index 2ef8766c..bb7d94c0 100644
--- a/qt/gen_qvariant.go
+++ b/qt/gen_qvariant.go
@@ -27,6 +27,9 @@ func (this *QVariant) cPointer() *C.QVariant {
 }
 
 func newQVariant(h *C.QVariant) *QVariant {
+	if h == nil {
+		return nil
+	}
 	return &QVariant{h: h}
 }
 
@@ -796,6 +799,9 @@ func (this *QVariantComparisonHelper) cPointer() *C.QVariantComparisonHelper {
 }
 
 func newQVariantComparisonHelper(h *C.QVariantComparisonHelper) *QVariantComparisonHelper {
+	if h == nil {
+		return nil
+	}
 	return &QVariantComparisonHelper{h: h}
 }
 
@@ -831,6 +837,9 @@ func (this *QSequentialIterable) cPointer() *C.QSequentialIterable {
 }
 
 func newQSequentialIterable(h *C.QSequentialIterable) *QSequentialIterable {
+	if h == nil {
+		return nil
+	}
 	return &QSequentialIterable{h: h}
 }
 
@@ -909,6 +918,9 @@ func (this *QAssociativeIterable) cPointer() *C.QAssociativeIterable {
 }
 
 func newQAssociativeIterable(h *C.QAssociativeIterable) *QAssociativeIterable {
+	if h == nil {
+		return nil
+	}
 	return &QAssociativeIterable{h: h}
 }
 
@@ -993,6 +1005,9 @@ func (this *QVariant__PrivateShared) cPointer() *C.QVariant__PrivateShared {
 }
 
 func newQVariant__PrivateShared(h *C.QVariant__PrivateShared) *QVariant__PrivateShared {
+	if h == nil {
+		return nil
+	}
 	return &QVariant__PrivateShared{h: h}
 }
 
@@ -1016,6 +1031,9 @@ func (this *QVariant__Handler) cPointer() *C.QVariant__Handler {
 }
 
 func newQVariant__Handler(h *C.QVariant__Handler) *QVariant__Handler {
+	if h == nil {
+		return nil
+	}
 	return &QVariant__Handler{h: h}
 }
 
@@ -1039,6 +1057,9 @@ func (this *QSequentialIterable__const_iterator) cPointer() *C.QSequentialIterab
 }
 
 func newQSequentialIterable__const_iterator(h *C.QSequentialIterable__const_iterator) *QSequentialIterable__const_iterator {
+	if h == nil {
+		return nil
+	}
 	return &QSequentialIterable__const_iterator{h: h}
 }
 
@@ -1133,6 +1154,9 @@ func (this *QAssociativeIterable__const_iterator) cPointer() *C.QAssociativeIter
 }
 
 func newQAssociativeIterable__const_iterator(h *C.QAssociativeIterable__const_iterator) *QAssociativeIterable__const_iterator {
+	if h == nil {
+		return nil
+	}
 	return &QAssociativeIterable__const_iterator{h: h}
 }
 
diff --git a/qt/gen_qvariantanimation.go b/qt/gen_qvariantanimation.go
index a4b2f967..8414fa2d 100644
--- a/qt/gen_qvariantanimation.go
+++ b/qt/gen_qvariantanimation.go
@@ -29,6 +29,9 @@ func (this *QVariantAnimation) cPointer() *C.QVariantAnimation {
 }
 
 func newQVariantAnimation(h *C.QVariantAnimation) *QVariantAnimation {
+	if h == nil {
+		return nil
+	}
 	return &QVariantAnimation{h: h, QAbstractAnimation: newQAbstractAnimation_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qvector2d.go b/qt/gen_qvector2d.go
index d4e32b29..dff62769 100644
--- a/qt/gen_qvector2d.go
+++ b/qt/gen_qvector2d.go
@@ -27,6 +27,9 @@ func (this *QVector2D) cPointer() *C.QVector2D {
 }
 
 func newQVector2D(h *C.QVector2D) *QVector2D {
+	if h == nil {
+		return nil
+	}
 	return &QVector2D{h: h}
 }
 
diff --git a/qt/gen_qvector3d.go b/qt/gen_qvector3d.go
index 62fd3aeb..6a0cbd7e 100644
--- a/qt/gen_qvector3d.go
+++ b/qt/gen_qvector3d.go
@@ -27,6 +27,9 @@ func (this *QVector3D) cPointer() *C.QVector3D {
 }
 
 func newQVector3D(h *C.QVector3D) *QVector3D {
+	if h == nil {
+		return nil
+	}
 	return &QVector3D{h: h}
 }
 
diff --git a/qt/gen_qvector4d.go b/qt/gen_qvector4d.go
index 827ed74e..fef969dc 100644
--- a/qt/gen_qvector4d.go
+++ b/qt/gen_qvector4d.go
@@ -27,6 +27,9 @@ func (this *QVector4D) cPointer() *C.QVector4D {
 }
 
 func newQVector4D(h *C.QVector4D) *QVector4D {
+	if h == nil {
+		return nil
+	}
 	return &QVector4D{h: h}
 }
 
diff --git a/qt/gen_qversionnumber.go b/qt/gen_qversionnumber.go
index a0cf5f56..d4a9c001 100644
--- a/qt/gen_qversionnumber.go
+++ b/qt/gen_qversionnumber.go
@@ -27,6 +27,9 @@ func (this *QVersionNumber) cPointer() *C.QVersionNumber {
 }
 
 func newQVersionNumber(h *C.QVersionNumber) *QVersionNumber {
+	if h == nil {
+		return nil
+	}
 	return &QVersionNumber{h: h}
 }
 
diff --git a/qt/gen_qwaitcondition.go b/qt/gen_qwaitcondition.go
index fc7e0bcf..a418e434 100644
--- a/qt/gen_qwaitcondition.go
+++ b/qt/gen_qwaitcondition.go
@@ -26,6 +26,9 @@ func (this *QWaitCondition) cPointer() *C.QWaitCondition {
 }
 
 func newQWaitCondition(h *C.QWaitCondition) *QWaitCondition {
+	if h == nil {
+		return nil
+	}
 	return &QWaitCondition{h: h}
 }
 
diff --git a/qt/gen_qwhatsthis.go b/qt/gen_qwhatsthis.go
index 128d3956..de3379ce 100644
--- a/qt/gen_qwhatsthis.go
+++ b/qt/gen_qwhatsthis.go
@@ -26,6 +26,9 @@ func (this *QWhatsThis) cPointer() *C.QWhatsThis {
 }
 
 func newQWhatsThis(h *C.QWhatsThis) *QWhatsThis {
+	if h == nil {
+		return nil
+	}
 	return &QWhatsThis{h: h}
 }
 
diff --git a/qt/gen_qwidget.go b/qt/gen_qwidget.go
index 398893fe..5f457c9a 100644
--- a/qt/gen_qwidget.go
+++ b/qt/gen_qwidget.go
@@ -28,6 +28,9 @@ func (this *QWidgetData) cPointer() *C.QWidgetData {
 }
 
 func newQWidgetData(h *C.QWidgetData) *QWidgetData {
+	if h == nil {
+		return nil
+	}
 	return &QWidgetData{h: h}
 }
 
@@ -63,6 +66,9 @@ func (this *QWidget) cPointer() *C.QWidget {
 }
 
 func newQWidget(h *C.QWidget) *QWidget {
+	if h == nil {
+		return nil
+	}
 	return &QWidget{h: h, QObject: newQObject_U(unsafe.Pointer(h)), QPaintDevice: newQPaintDevice_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qwidgetaction.go b/qt/gen_qwidgetaction.go
index ece0647a..05a23e50 100644
--- a/qt/gen_qwidgetaction.go
+++ b/qt/gen_qwidgetaction.go
@@ -27,6 +27,9 @@ func (this *QWidgetAction) cPointer() *C.QWidgetAction {
 }
 
 func newQWidgetAction(h *C.QWidgetAction) *QWidgetAction {
+	if h == nil {
+		return nil
+	}
 	return &QWidgetAction{h: h, QAction: newQAction_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qwindow.go b/qt/gen_qwindow.go
index 244aa4ec..ecfbae02 100644
--- a/qt/gen_qwindow.go
+++ b/qt/gen_qwindow.go
@@ -30,6 +30,9 @@ func (this *QWindow) cPointer() *C.QWindow {
 }
 
 func newQWindow(h *C.QWindow) *QWindow {
+	if h == nil {
+		return nil
+	}
 	return &QWindow{h: h, QObject: newQObject_U(unsafe.Pointer(h)), QSurface: newQSurface_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qwizard.go b/qt/gen_qwizard.go
index 81da0bc9..3bdf1833 100644
--- a/qt/gen_qwizard.go
+++ b/qt/gen_qwizard.go
@@ -29,6 +29,9 @@ func (this *QWizard) cPointer() *C.QWizard {
 }
 
 func newQWizard(h *C.QWizard) *QWizard {
+	if h == nil {
+		return nil
+	}
 	return &QWizard{h: h, QDialog: newQDialog_U(unsafe.Pointer(h))}
 }
 
@@ -464,6 +467,9 @@ func (this *QWizardPage) cPointer() *C.QWizardPage {
 }
 
 func newQWizardPage(h *C.QWizardPage) *QWizardPage {
+	if h == nil {
+		return nil
+	}
 	return &QWizardPage{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
 }
 
diff --git a/qt/gen_qxmlstream.go b/qt/gen_qxmlstream.go
index 405c1803..8f8b5581 100644
--- a/qt/gen_qxmlstream.go
+++ b/qt/gen_qxmlstream.go
@@ -26,6 +26,9 @@ func (this *QXmlStreamStringRef) cPointer() *C.QXmlStreamStringRef {
 }
 
 func newQXmlStreamStringRef(h *C.QXmlStreamStringRef) *QXmlStreamStringRef {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamStringRef{h: h}
 }
 
@@ -100,6 +103,9 @@ func (this *QXmlStreamAttribute) cPointer() *C.QXmlStreamAttribute {
 }
 
 func newQXmlStreamAttribute(h *C.QXmlStreamAttribute) *QXmlStreamAttribute {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamAttribute{h: h}
 }
 
@@ -176,6 +182,9 @@ func (this *QXmlStreamNamespaceDeclaration) cPointer() *C.QXmlStreamNamespaceDec
 }
 
 func newQXmlStreamNamespaceDeclaration(h *C.QXmlStreamNamespaceDeclaration) *QXmlStreamNamespaceDeclaration {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamNamespaceDeclaration{h: h}
 }
 
@@ -235,6 +244,9 @@ func (this *QXmlStreamNotationDeclaration) cPointer() *C.QXmlStreamNotationDecla
 }
 
 func newQXmlStreamNotationDeclaration(h *C.QXmlStreamNotationDeclaration) *QXmlStreamNotationDeclaration {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamNotationDeclaration{h: h}
 }
 
@@ -284,6 +296,9 @@ func (this *QXmlStreamEntityDeclaration) cPointer() *C.QXmlStreamEntityDeclarati
 }
 
 func newQXmlStreamEntityDeclaration(h *C.QXmlStreamEntityDeclaration) *QXmlStreamEntityDeclaration {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamEntityDeclaration{h: h}
 }
 
@@ -333,6 +348,9 @@ func (this *QXmlStreamEntityResolver) cPointer() *C.QXmlStreamEntityResolver {
 }
 
 func newQXmlStreamEntityResolver(h *C.QXmlStreamEntityResolver) *QXmlStreamEntityResolver {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamEntityResolver{h: h}
 }
 
@@ -384,6 +402,9 @@ func (this *QXmlStreamReader) cPointer() *C.QXmlStreamReader {
 }
 
 func newQXmlStreamReader(h *C.QXmlStreamReader) *QXmlStreamReader {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamReader{h: h}
 }
 
@@ -705,6 +726,9 @@ func (this *QXmlStreamWriter) cPointer() *C.QXmlStreamWriter {
 }
 
 func newQXmlStreamWriter(h *C.QXmlStreamWriter) *QXmlStreamWriter {
+	if h == nil {
+		return nil
+	}
 	return &QXmlStreamWriter{h: h}
 }