diff options
author | danfe <danfe@FreeBSD.org> | 2015-04-19 00:39:18 +0800 |
---|---|---|
committer | danfe <danfe@FreeBSD.org> | 2015-04-19 00:39:18 +0800 |
commit | e8c7f7b9f434c24fa79087ed1b5f8574867c5d41 (patch) | |
tree | b7574ad17452abfbf4a121c957e805a6fd59dc94 | |
parent | 2b7981cf5d9ffec9417f63a27024f188f71453d8 (diff) | |
download | freebsd-ports-gnome-e8c7f7b9f434c24fa79087ed1b5f8574867c5d41.tar.gz freebsd-ports-gnome-e8c7f7b9f434c24fa79087ed1b5f8574867c5d41.tar.zst freebsd-ports-gnome-e8c7f7b9f434c24fa79087ed1b5f8574867c5d41.zip |
- Clang insists that reference cannot be bound to dereferenced null pointer
in well-defined C++ code (that is correct) and evaluates comparisons like
&foo == 0 to false, which breaks NetRadiant; "fix" this with a dirty hack
by casting those "bad" references to a local volatile int variable (since
NetRadiant is based on GtkRadiant 1.5 codebase, this is the same bug that
was fixed in r384239; patches are slightly different though)
- While here, make a comment more accurate, and bump port revision
-rw-r--r-- | games/netradiant/Makefile | 4 | ||||
-rw-r--r-- | games/netradiant/files/patch-radiant_treemodel.cpp | 56 |
2 files changed, 58 insertions, 2 deletions
diff --git a/games/netradiant/Makefile b/games/netradiant/Makefile index 58dbf31d76af..ee0a4c6906c9 100644 --- a/games/netradiant/Makefile +++ b/games/netradiant/Makefile @@ -3,7 +3,7 @@ PORTNAME= netradiant PORTVERSION= 20130630 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= games cad MASTER_SITES= http://ingar.satgnu.net/gtkradiant/files/ \ http://freebsd.nsu.ru/distfiles/ @@ -48,7 +48,7 @@ pre-install: # Fix permissions of some files (drop bogus execute bit) @${FIND} ${WRKSRC}/install/osirion.game -type f | ${XARGS} ${CHMOD} a-x @${CHMOD} a-x ${WRKSRC}/install/games/osirion.game -# Remove extra copy of GNU GPL from what we install +# Remove a copy of GNU GPL from what we are going to install @${RM} ${WRKSRC}/install/GPL.txt do-install: diff --git a/games/netradiant/files/patch-radiant_treemodel.cpp b/games/netradiant/files/patch-radiant_treemodel.cpp new file mode 100644 index 000000000000..a2d0329bf284 --- /dev/null +++ b/games/netradiant/files/patch-radiant_treemodel.cpp @@ -0,0 +1,56 @@ +--- radiant/treemodel.cpp.orig 2013-06-30 14:04:35 UTC ++++ radiant/treemodel.cpp +@@ -647,7 +647,12 @@ void detach( const NameCallback& callbac + }; + + void node_attach_name_changed_callback( scene::Node& node, const NameCallback& callback ){ +- if ( &node != 0 ) { ++ // Reference cannot be bound to dereferenced null pointer in a ++ // well-defined C++ code, and Clang will assume that comparison ++ // below always evaluates to true, resulting in segmentation ++ // fault. Use a dirty hack to force Clang to check for null. ++ volatile int n = (int)&node; ++ if ( n != 0 ) { + Nameable* nameable = Node_getNameable( node ); + if ( nameable != 0 ) { + nameable->attach( callback ); +@@ -655,7 +660,8 @@ void node_attach_name_changed_callback( + } + } + void node_detach_name_changed_callback( scene::Node& node, const NameCallback& callback ){ +- if ( &node != 0 ) { ++ volatile int n = (int)&node; // see the comment on line 650 ++ if ( n != 0 ) { + Nameable* nameable = Node_getNameable( node ); + if ( nameable != 0 ) { + nameable->detach( callback ); +@@ -1124,7 +1130,8 @@ void graph_tree_model_row_deleted( Graph + const char* node_get_name( scene::Node& node ); + + const char* node_get_name_safe( scene::Node& node ){ +- if ( &node == 0 ) { ++ volatile int n = (int)&node; // see the comment on line 650 ++ if ( n == 0 ) { + return ""; + } + return node_get_name( node ); +@@ -1142,7 +1149,8 @@ GraphTreeNode* graph_tree_model_find_par + } + + void node_attach_name_changed_callback( scene::Node& node, const NameCallback& callback ){ +- if ( &node != 0 ) { ++ volatile int n = (int)&node; // see the comment on line 650 ++ if ( n != 0 ) { + Nameable* nameable = Node_getNameable( node ); + if ( nameable != 0 ) { + nameable->attach( callback ); +@@ -1150,7 +1158,8 @@ void node_attach_name_changed_callback( + } + } + void node_detach_name_changed_callback( scene::Node& node, const NameCallback& callback ){ +- if ( &node != 0 ) { ++ volatile int n = (int)&node; // see the comment on line 650 ++ if ( n != 0 ) { + Nameable* nameable = Node_getNameable( node ); + if ( nameable != 0 ) { + nameable->detach( callback ); |