};
void node_attach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
- if ( &node != 0 ) {
+ // Reference cannot be bound to dereferenced null pointer in well-defined
+ // C++ code, and Clang will assume that comparison below always evaluates
+ // to true, resulting in a segmentation fault. Use a dirty hack to force
+ // Clang to check those "bad" references for null nonetheless.
+ volatile intptr_t n = (intptr_t)&node;
+
+ if ( n != 0 ) {
Nameable* nameable = Node_getNameable( node );
if ( nameable != 0 ) {
nameable->attach( callback );
}
}
void node_detach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
- if ( &node != 0 ) {
+ volatile intptr_t n = (intptr_t)&node; // see the comment on line 650
+
+ if ( n != 0 ) {
Nameable* nameable = Node_getNameable( node );
if ( nameable != 0 ) {
nameable->detach( callback );
const char* node_get_name( scene::Node& node );
const char* node_get_name_safe( scene::Node& node ){
- if ( &node == 0 ) {
+ volatile intptr_t n = (intptr_t)&node; // see the comment on line 650
+ if ( n == 0 ) {
return "";
}
return node_get_name( node );
}
void node_attach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
- if ( &node != 0 ) {
+ volatile intptr_t n = (intptr_t)&node; // see the comment on line 650
+ if ( n != 0 ) {
Nameable* nameable = Node_getNameable( node );
if ( nameable != 0 ) {
nameable->attach( callback );
}
}
void node_detach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
- if ( &node != 0 ) {
+ volatile intptr_t n = (intptr_t)&node; // see the comment on line 650
+ if ( n != 0 ) {
Nameable* nameable = Node_getNameable( node );
if ( nameable != 0 ) {
nameable->detach( callback );