Looks like BuildConnVal() can be called from the connection destructor
and will set the origin to "this" and thus create a dangling pointer.
The connection will destruct but since conn_val has a reference
counting mechanism, it will still keep referring to the connection.
I propose to fix this by creating a destructing flag bit-field inside
connection. It will be initialized to zero, but set to 1 just when the
destructor is entered.
Looking forward to your comments! I will provide a patch, if desired.