3.6 None and null pointers
A null pointer argument is interpreted by Qt as a place holder for a pointer
pointing to nothing and the design of SIP reflects this: you can pass None
in many places where you can pass a (pointer to a) QObject.
PyQt converts None to a null pointer before passing it on to Qt.
The design of Open Inventor is different: a null pointer argument provokes
almost always a crash or program termination because of an assertion violation.
Open Inventor accepts only null pointer arguments when the interface specifies
explicitly a null pointer.
IVuPy raises a Python exception to prevent program termination when you pass
None by accident.
However, there are a few exceptions where passing None is fine (read
the underlying C++ code or the Coin3D documentation).
This concerns
- the second argument in the member functions:
| SbBool SoClipPlaneManip::replaceManip( |
SoPath *path,
SoClipPlane *plane) |
-
| SbBool SoDirectionalLightManip::replaceManip( |
SoPath *path,
SoDirectionalLight *light) |
-
| SbBool SoPointLightManip::replaceManip( |
SoPath *path,
SoPointLight *light) |
-
| SbBool SoSpotLightManip::replaceManip( |
SoPath *path,
SoSpotLight *plane) |
-
| SbBool SoTransformManip::replaceManip( |
SoPath *path,
SoTransform *transform) |
-
- and the first argument in the member functions:
| void SoQtConstrainedViewer::setCamera( |
SoCamera *camera) |
-
| void SoQtExaminerViewer::setCamera( |
SoCamera *camera) |
-
| void SoQtFlyViewer::setCamera( |
SoCamera *camera) |
-
| void SoQtPlaneViewer::setCamera( |
SoCamera *camera) |
-
| void SoQtViewer::setCamera( |
SoCamera *camera) |
-
- and
| void SoQtRenderArea::setSceneGraph( |
SoNode *node) |
-
| void SoQtViewer::setSceneGraph( |
SoNode *node) |
-
| void SoSceneManager::setSceneGraph( |
SoNode *node) |
-
Let me know if you find other C++ member functions in the Open Inventor API
which handle a null pointer gracefully.
Release cvs, documentation updated on April 5, 2006. Hosted on