[Kst] Strange problem using the change data file tool

Brisset, Nicolas Nicolas.Brisset at eurocopter.com
Thu Feb 23 17:18:05 CET 2006


> We could do this:
> 
> Index: datawizard.ui.h
> ===================================================================
> --- datawizard.ui.h     (revision 512716)
> +++ datawizard.ui.h     (working copy)
> @@ -252,6 +252,9 @@
>         KstDataSourcePtr ds =
> *KST::dataSourceList.findReusableFileName(_file);
>         if (!ds) {
>             ds = KstDataSource::loadSource(_file);
> +           KST::dataSourceList.lock().writeLock();
> +           KST::dataSourceList.append(ds);
> +           KST::dataSourceList.lock().writeUnlock();
>         }
>         ds->readLock();
>         _kstDataRange->setAllowTime(ds && 
> ds->supportsTimeConversions());
> 
> 
> The reason it wasn't done in the past was that we don't want 
> to hold onto a datasource that isn't being used.  It's 
> possible that a datasource instance takes up quite a bit of 
> memory.  Does this patch make it work any better for you?
YES ! That's exactly what I was hoping for :-) Thanks !

By the way, I don't think the problem you mention is so bad. It sounds
reasonable to me to expect that once the user clicks the "Next" button
on the first page, he has chosen the appropriate file and is really
going to work with it. The only case where that assumption would be
wrong is if he clicks "Cancel" before finishing the wizard.. The
instance will be kept until he nexts purges unused data from the data
manager.
I think the benefit of not calling the constructor twice when using the
wizard "normally" by far surpasses the cost of a few lost KB or even MB
in some much less frequent occasions.

Nicolas


More information about the Kst mailing list