In my framework I have a DataSource1 instance that was dropped in design time on a Form.
At some point at run time I need to "convert" it to a reference to another DataSource2 (on a Data Module).
Is simply setting:
DataSource1 := DataSource2;
Enough to make DataSource1 a reference of DataSource2? it appears that DataSource1 is not being destroyed at this point - It is destroyed when the Owner of DataSource2 is destroyed, And that there are in fact two instances of TDataSource.
Or do I need to explicitly free DataSource1 first?
DataSource1.Free;
DataSource1 := DataSource2;
What is the correct way? (Besides declaring DataSource1 as a reference in the first place)