Browse files

Fixed reference_p() to return false for NULL.

This indirectly fixes one of the issues exposed in the following:

sparklemotion/nokogiri#1047
#2844

This is not the root cause of the Nokogiri-relate segvs, which
appear to be Nokogiri (libxml2) releasing data for a node while
a Data object wrapping it is still reachable and hence is having
mark() called on it.
  • Loading branch information...
1 parent 56d2edb commit eba5d40bc1275289b8878501e562dc7c22dc4f18 @brixen brixen committed Feb 18, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 vm/oop.hpp
View
2 vm/oop.hpp
@@ -54,7 +54,7 @@ namespace rubinius {
* various object types and are used to define predicates. Use the predicates
* (ie reference_p(), fixnum_p(), symbol_p()) directly.
*/
-#define __REFERENCE_P__(v) (((intptr_t)(v) & TAG_REF_MASK) == TAG_REF)
+#define __REFERENCE_P__(v) ((v) && (((intptr_t)(v) & TAG_REF_MASK) == TAG_REF))
#define __FIXNUM_P__(v) (((intptr_t)(v) & TAG_FIXNUM_MASK) == TAG_FIXNUM)
#define __SYMBOL_P__(v) (((intptr_t)(v) & TAG_SYMBOL_MASK) == TAG_SYMBOL)

0 comments on commit eba5d40

Please sign in to comment.