Bugfix: reset data_source to NULL upon detaching

Prevent referencing to possibly freed data_source in the destructor