[Kst] [Bug 115670] Some datasources call constructors/destructors [nb_vectors] times upon reload

Nicolas Brisset nicolas.brisset at eurocopter.com
Tue Nov 8 11:09:05 CET 2005

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

------- Additional Comments From nicolas.brisset eurocopter com  2005-11-08 11:09 -------
>   It's mostly because the datasources expected this, and well, how do you 
> "reset" a datasource?  If it has no reset() function, then the only choice is 
> to destroy it and create a new one. 
Sure, when reset is not implemented you can only destroy it and create a new one. This is *not* what I was wondering about...

The thing that surprised me was that you'd need to destroy it and create a new ones 10 times if you are using 10 vectors from that datasource, 15 times if you are using 15, etc. To me, it sounded like destroying the datasource instance and recreating one should be enough to allow access to all its vectors. 

As a matter of fact, trying to evidence my point, I noticed that 
- with cdf (which implements reset, please ignore my wrong comment above!), the reset() method gets called as many times as there are vectors
- with another datasource not implementing reset(), the constructor gets called as many times as there are vectors, after which the initial datasource instance is destroyed. If you reload more than once, only the first instance created in the previous loading gets killed, which looks to me like a potential memleak...

Once again, I understand the need for a reset() method or destroying and creating a new datasource as fallback, but I still wonder why it depends on the number of vectors provided by that source. Pardon me for insisting on this, but I definitely feel there is something strange there. Why should we call reset() more than once, when it actually resets the whole datasource instance so that one call would be enough, and why would we need x instances of a given datasource if it provides x vectors (especially when they are not destroyed later) ?

More information about the Kst mailing list