diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 0b7617e..d2eaf44 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -751,7 +751,7 @@ bool isUserType(PyObject* pyObj)
 Py_hash_t hash(PyObject* pyObj)
 {
     assert(Shiboken::Object::checkType(pyObj));
-    return reinterpret_cast<Py_hash_t>(reinterpret_cast<SbkObject*>(pyObj)->d->cptr[0]);
+    return reinterpret_cast<Py_hash_t>(reinterpret_cast<SbkObject*>(pyObj));
 }
 
 static void setSequenceOwnership(PyObject* pyObj, bool owner)
diff --git a/tests/otherbinding/objtypehashes_test.py b/tests/otherbinding/objtypehashes_test.py
index 37ae9b8..24f3b1e 100644
--- a/tests/otherbinding/objtypehashes_test.py
+++ b/tests/otherbinding/objtypehashes_test.py
@@ -1,6 +1,7 @@
 import unittest
 from sample import *
 from other import *
+import shiboken
 
 class TestHashFuncs (unittest.TestCase):
 
@@ -11,7 +12,14 @@ class TestHashFuncs (unittest.TestCase):
         hash1 = hash(obj1)
         hash2 = hash(obj2)
         self.assertNotEqual(hash1, hash2)
-        self.assertNotEqual(hash(HandleHolder()), hash(HandleHolder()))
+
+        # Now invalidate the object and test its hash.  It shouldn't segfault.
+        shiboken.invalidate(obj1)
+
+        hash1_2 = hash(obj1)
+        self.assertEqual(hash1_2, hash1)
+
+
 
 if __name__ == '__main__':
     unittest.main()
