I have made the following changes intended for :
  nemo:devel:mw / qmlcanvas

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.merproject.org//request/show/215

Thank You,
Ruediger Gad

[This message was auto-generated]

---

Request # 215:

Messages from BOSS:

State: review at 2013-04-15T20:47:31 by cibot

Reviews:
       accepted by cibot : Prechecks succeeded.
       new for nemo:devel:mw : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:wonko:branches:nemo:devel:mw / qmlcanvas -> nemo:devel:mw / 
qmlcanvas
  
changes files:
--------------
--- qmlcanvas.changes
+++ qmlcanvas.changes
@@ -0,0 +1,3 @@
+* Mon Apr 15 2013 Ruediger Gad <[email protected]> - 0.1.0
+- Add null pointer checks.
+

new:
----
  qmlcanvas-add-null-pointer-checks.patch

spec files:
-----------
--- qmlcanvas.spec
+++ qmlcanvas.spec
@@ -16,6 +16,7 @@
 URL:        https://qt.gitorious.org/qt-labs/qmlcanvas
 Source0:    %{name}_%{version}.tar.gz
 Source100:  qmlcanvas.yaml
+Patch0:     qmlcanvas-add-null-pointer-checks.patch
 BuildRequires:  pkgconfig(QtCore) >= 4.7.0
 BuildRequires:  pkgconfig(QtGui)
 
@@ -26,6 +27,8 @@
 %prep
 %setup -q -n %{name}-%{version}
 
+# qmlcanvas-add-null-pointer-checks.patch
+%patch0 -p1
 # >> setup
 # << setup
 

other changes:
--------------

++++++ qmlcanvas-add-null-pointer-checks.patch (new)
--- qmlcanvas-add-null-pointer-checks.patch
+++ qmlcanvas-add-null-pointer-checks.patch
@@ -0,0 +1,140 @@
+diff --git a/src/canvas.cpp b/src/canvas.cpp
+index 73adff3..b179937 100644
+--- a/src/canvas.cpp
++++ b/src/canvas.cpp
+@@ -59,6 +59,11 @@ Canvas::Canvas(QDeclarativeItem *parent)
+ 
+ void Canvas::componentComplete()
+ {
++    if (!m_context) {
++        qDebug("Canvas::componentComplete, m_context is null, doing 
nothing.");
++        return;
++    }
++
+     if (m_canvasWidth == 0 && m_canvasHeight == 0)
+         m_context->setSize(width(), height());
+     else
+@@ -71,6 +76,15 @@ void Canvas::componentComplete()
+ 
+ void Canvas::paint(QPainter *painter, const QStyleOptionGraphicsItem *, 
QWidget *)
+ {
++    if (!painter) {
++        qDebug("Canvas::paint, painter is null, doing nothing.");
++        return;
++    }
++    if (!m_context) {
++        qDebug("Canvas::paint, m_context is null, doing nothing.");
++        return;
++    }
++
+     m_context->setInPaint(true);
+     emit paint();
+ 
+@@ -166,6 +180,11 @@ void Canvas::requestPaint()
+ 
+ void Canvas::geometryChanged(const QRectF &newGeometry, const QRectF 
&oldGeometry)
+ {
++    if (!m_context) {
++        qDebug("Canvas::geometry, m_context is null, doing nothing.");
++        return;
++    }
++
+     if (m_canvasWidth == 0 && m_canvasHeight == 0
+         && newGeometry.width() > 0 && newGeometry.height() > 0) {
+         m_context->setSize(width(), height());
+@@ -175,6 +194,11 @@ void Canvas::geometryChanged(const QRectF &newGeometry, 
const QRectF &oldGeometr
+ 
+ void Canvas::setCanvasWidth(int newWidth)
+ {
++    if (!m_context) {
++        qDebug("Canvas::setCanvasWidth, m_context is null, doing nothing.");
++        return;
++    }
++
+     if (m_canvasWidth != newWidth) {
+         m_canvasWidth = newWidth;
+         m_context->setSize(m_canvasWidth, m_canvasHeight);
+@@ -184,6 +208,11 @@ void Canvas::setCanvasWidth(int newWidth)
+ 
+ void Canvas::setCanvasHeight(int newHeight)
+ {
++    if (!m_context) {
++        qDebug("Canvas::setCanvasHeight, m_context is null, doing nothing.");
++        return;
++    }
++
+     if (m_canvasHeight != newHeight) {
+         m_canvasHeight = newHeight;
+         m_context->setSize(m_canvasWidth, m_canvasHeight);
+@@ -221,11 +250,21 @@ Canvas::FillMode Canvas::fillMode() const
+ 
+ bool Canvas::save(const QString &filename) const
+ {
++    if (!m_context) {
++        qDebug("Canvas::save, m_context is null, doing nothing.");
++        return false;
++    }
++
+     return m_context->pixmap().save(filename);
+ }
+ 
+ CanvasImage *Canvas::toImage() const
+ {
++    if (!m_context) {
++        qDebug("Canvas::toImage, m_context is null, doing nothing.");
++        return 0;
++    }
++
+     return new CanvasImage(m_context->pixmap());
+ }
+ 
+diff --git a/src/canvastimer.cpp b/src/canvastimer.cpp
+index e3492fd..08c2d98 100644
+--- a/src/canvastimer.cpp
++++ b/src/canvastimer.cpp
+@@ -61,8 +61,17 @@ void CanvasTimer::handleTimeout()
+ 
+ void CanvasTimer::createTimer(QObject *parent, const QScriptValue &val, long 
timeout, bool singleshot)
+ {
++    if (!parent) {
++        qDebug("CanvasTimer::createTimer, parent is null, doing nothing.");
++        return;
++    }
+ 
+     CanvasTimer *timer = new CanvasTimer(parent, val);
++    if (!timer) {
++        qDebug("CanvasTimer::createTimer, creation of timer failed, 
aborting.");
++        return;
++    }
++
+     timer->setInterval(timeout);
+     timer->setSingleShot(singleshot);
+     connect(timer, SIGNAL(timeout()), timer, SLOT(handleTimeout()));
+@@ -72,6 +81,11 @@ void CanvasTimer::createTimer(QObject *parent, const 
QScriptValue &val, long tim
+ 
+ void CanvasTimer::removeTimer(CanvasTimer *timer)
+ {
++    if (!timer) {
++        qDebug("CanvasTimer::removeTimer, timer is null, doing nothing.");
++        return;
++    }
++
+     activeTimers()->removeAll(timer);
+     timer->deleteLater();
+ }
+diff --git a/src/context2d.cpp b/src/context2d.cpp
+index b18dd34..243cd39 100644
+--- a/src/context2d.cpp
++++ b/src/context2d.cpp
+@@ -1086,6 +1086,11 @@ void Context2D::scheduleChange()
+ 
+ void Context2D::timerEvent(QTimerEvent *e)
+ {
++    if (!e) {
++        qDebug("Context2D::timerEvent, e is null, doing nothing.");
++        return;
++    }
++
+     if (e->timerId() == m_changeTimerId) {
+         killTimer(m_changeTimerId);
+         m_changeTimerId = -1;

++++++ qmlcanvas.yaml
--- qmlcanvas.yaml
+++ qmlcanvas.yaml
@@ -7,6 +7,8 @@
 URL: https://qt.gitorious.org/qt-labs/qmlcanvas
 Sources:
     - "%{name}_%{version}.tar.gz"
+Patches:
+    - "qmlcanvas-add-null-pointer-checks.patch"
 Description:  
   Provides a canvas for QML that can be used, e.g., for drawing images.
 



Reply via email to