diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index e908fd8e915b605439e05e3234990b6c5d0c05e5..a08d26f70818943f78de9cac5c83f7c8cedeadea 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -138,8 +138,8 @@ QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)
 /*!
     \internal
  */
-QOpenGLPaintDevice::QOpenGLPaintDevice(QOpenGLPaintDevicePrivate *dd)
-    : d_ptr(dd)
+QOpenGLPaintDevice::QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd)
+    : d_ptr(&dd)
 {
 }
 
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index dda3bfe43f607c1ec7658a0d068682ee7175a228..10cee842ab0b853290b22f3fac38e625dc707cb4 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -53,7 +53,6 @@ public:
     QOpenGLPaintDevice();
     explicit QOpenGLPaintDevice(const QSize &size);
     QOpenGLPaintDevice(int width, int height);
-    QOpenGLPaintDevice(QOpenGLPaintDevicePrivate *dd);
     virtual ~QOpenGLPaintDevice();
 
     int devType() const { return QInternal::OpenGL; }
@@ -76,6 +75,7 @@ public:
     virtual void ensureActiveTarget();
 
 protected:
+    QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd);
     int metric(QPaintDevice::PaintDeviceMetric metric) const;
 
     Q_DISABLE_COPY(QOpenGLPaintDevice)
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 8a4e0c8ffdd725f6c72c65b084c2940a73b434a7..23bb1f7050cec108db75982081a96f2dd5d7e4a7 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -471,7 +471,7 @@ class QOpenGLWidgetPaintDevice : public QOpenGLPaintDevice
 {
 public:
     QOpenGLWidgetPaintDevice(QOpenGLWidget *widget)
-        : QOpenGLPaintDevice(new QOpenGLWidgetPaintDevicePrivate(widget)) { }
+        : QOpenGLPaintDevice(*new QOpenGLWidgetPaintDevicePrivate(widget)) { }
     void ensureActiveTarget() Q_DECL_OVERRIDE;
 };