diff -r synaptic-0.63clean/common/rpackagecache.h synaptic-0.63cleanPath/common/rpackagecache.h
53a54,56
>    inline pkgCache *cache() {
>       return _cache;
>    };
diff -r synaptic-0.63clean/common/rpackage.cc synaptic-0.63cleanPath/common/rpackage.cc
126a127,128
>    if(_lister->isAddLoaded()) return getSummaryCache();
> 
139d140
< 
141a143,144
>    if(_lister->isAddLoaded()) return getMaintainerCache();
> 
151a155,170
> const char *RPackage::description()
> {
>    if(_lister->isAddLoaded()) return getDescriptionCache();
> 
>    static string _description;
>    pkgCache::VerIterator ver = (*_depcache)[*_package].CandidateVerIter(*_depcache);
> 
>    if (!ver.end()) {
>       pkgCache::DescIterator Desc = ver.TranslatedDescription();
>       pkgRecords::Parser & parser = _records->Lookup(Desc.FileList());
>       _description = parseDescription(parser.LongDesc());
>       return _description.c_str();
>    } else {
>       return "";
>    }
> }
218,231d236
< const char *RPackage::description()
< {
<    static string _description;
<    pkgCache::VerIterator ver = (*_depcache)[*_package].CandidateVerIter(*_depcache);
< 
<    if (!ver.end()) {
<       pkgCache::DescIterator Desc = ver.TranslatedDescription();
<       pkgRecords::Parser & parser = _records->Lookup(Desc.FileList());
<       _description = parseDescription(parser.LongDesc());
<       return _description.c_str();
<    } else {
<       return "";
<    }
< }
diff -r synaptic-0.63clean/common/rpackage.h synaptic-0.63cleanPath/common/rpackage.h
95a96,101
>    //cache
>    string descriptionCache;
>    string summaryCache;
>    string maintainerCache;
> 
> 
152a159,166
>    const char *getSummaryCache() { return summaryCache.c_str(); }
>    const char *getMaintainerCache() { return maintainerCache.c_str(); }
>    const char *getDescriptionCache() { return descriptionCache.c_str(); }
> 
>    void setSummaryCache(const string &summaryCache_) { summaryCache = summaryCache_; }
>    void setMaintainerCache(const string &maintainerCache_) { maintainerCache = maintainerCache_; }
>    void setDescriptionCache(const string &descriptionCache_) { descriptionCache = descriptionCache_; }
> 
diff -r synaptic-0.63clean/common/rpackagelister.cc synaptic-0.63cleanPath/common/rpackagelister.cc
34a35
> #include <fstream>
39a41
> #include <errno.h>
106d107
< 
113a115,126
>    _add_loader = NULL; //off
>    _add_enabled = true;
>    _add_loaded = false;
>    int err;
>    if((err = pthread_mutex_init(&_add_mutex, 0)) != 0) {
>       _add_enabled = false;
>       cerr << "Mutex init error: " << err << endl;
>    }
>    if((err = pthread_cond_init(&_add_cond, 0)) != 0) {
>       _add_enabled = false;
>       cerr << "Condition init error: " << err << endl;
>    }
123a137
> 
125a140,147
>    int err;
>    if((err = pthread_mutex_destroy(&_add_mutex) != 0)) {
>       cerr << "Mutex destroy error: " << err << endl;
>    }
>    if((err = pthread_cond_destroy(&_add_cond) != 0)) {
>       cerr << "Condition destroy error: " << err << endl;
>    }
> 
132a155,211
> 
> 
> bool RPackageLister::lock(pthread_mutex_t * mutex) {
>    int err;
>    if((err = pthread_mutex_lock(mutex)) != 0) {
>       cerr << "Error mutex lock: " << err << endl;
>       return false;
>    }
>    return true;
> }
> 
> bool RPackageLister::unlock(pthread_mutex_t * mutex) {
>    int err;
>    if((err = pthread_mutex_unlock(mutex)) != 0) {
>       cerr << "Error mutex unlock: " << err << endl;
>       return false;
>    }
>    return true;
> }
> 
> bool RPackageLister::setAddLoaded() {
>    if(!lock(&_add_mutex)) return false;
>    _add_loaded = true;
>    if(!unlock(&_add_mutex)) return false;
> 
>    int err;
>    if((err = pthread_cond_broadcast(&_add_cond)) != 0) {
>       cerr << "Error cond broadcast: " << err << endl;
>       return false;
>    }
> }
> 
> bool RPackageLister::isAddLoaded() {
>    bool res;
>    if(!lock(&_add_mutex)) return false;
>    res = _add_loaded;
>    if(!unlock(&_add_mutex)) return false;
>    return res;
> }
> 
> bool RPackageLister::waitAddLoaded() {
>    bool res = true;
> 
>    if(!lock(&_add_mutex)) return false;
>    if(!_add_loaded) {
>       int err;
>       if((err = pthread_cond_wait(&_add_cond, &_add_mutex)) != 0) {
>          cerr << "Error cond wait: " << err << endl;
>          res = false;
>       }
>    }
>    if(!unlock(&_add_mutex)) return false;
> 
>    return res;
> }
> 
> 
298a378,394
>    void * ret;
>    int err;
> 
>    //stop addloader
> 
>    if(!lock(&_add_mutex)) return false;
>    _add_enabled = false;
>    if(!unlock(&_add_mutex)) return false;
> 
>    if(_add_loader) {
>       if((err = pthread_join(*_add_loader, &ret)) != 0)
>          cerr << "Unable to join add loader: " << err << endl;
>       delete _add_loader;
>       _add_loader = NULL;
>    }
> 
> 
308c404
<    bool lock = true;
---
>    bool lockv = true;
310c406
<       lock = false;
---
>       lockv = false;
312c408
<    if (!_cache->open(*_progMeter,lock)) {
---
>    if (!_cache->open(*_progMeter,lockv)) {
327d422
< 
333d427
< 
337d430
< 
343d435
< 
347d438
< 
353d443
< 
364d453
< 
367d455
< 
409d496
< 
415d501
< 
419d504
< 
424d508
< 
425a510,632
> 
> 
>    //start addloader
>    if(!lock(&_add_mutex)) return false;
>    _add_enabled = true;
>    if(!unlock(&_add_mutex)) return false;
> 
>    pthread_attr_t attr;
>    if((err = pthread_attr_init(&attr)) != 0) {
>       cerr << "Unable to set attr: " << err << endl;
>       return _error->Error(_("Internal loader error."), err);
>    }
>    if((err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)) != 0) {
>       cerr << "Unable to set detachstate: " << err << endl;
>       return _error->Error(_("Internal loader error."), err);
>    }
>    _add_loader = new pthread_t;
>    if((err = pthread_create(_add_loader, &attr, addloader, (void *) this)) != 0) {
>       cerr << "Unable to pthread create: " << err << endl;
>       return _error->Error(_("Internal loader error."), err);
>    }
> 
>    return true;
> }
> 
> // LocalitySort - Sort a version list by package file locality          /*{{{*/
> // ---------------------------------------------------------------------
> 
> bool LocalityCompare(const void * a, const void * b) {
>    pkgCache::VerFile *A = (pkgCache::VerFile *) a;
>    pkgCache::VerFile *B = (pkgCache::VerFile *) b;
> 
>    if (A == 0 && B == 0)
>       return false;
>    if (A == 0)
>       return true;
>    if (B == 0)
>       return false;
> 
>    if (A->File == B->File)
>       return A->Offset < B->Offset;
>    return A->File < B->File;
> }
> 
> void * addloader(void * arg) {
>    // load package descriptions and vendors
> 
>    RPackageLister *_lister = (RPackageLister *) arg;
> 
>    pkgCache &Cache = *(_lister->cache()->cache());
>    pkgDepCache::Policy Plcy;
>    pkgRecords Recs(Cache);
>    if (_error->PendingError() == true) {
>       _error->Error(_("Internal loader error."));
>       return 0;
>    }
> 
>    bool enabled = true;
> 
>    //get file pointers
>    vector<pkgCache::DescFile *> dfs;
>    for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false && enabled; I++) {
>       // Find the proper version to use.
>       pkgCache::VerIterator V = Plcy.GetCandidateVer(I);
>       if (V.end() == false) {
>          dfs.push_back(V.DescriptionList().FileList());
>       }
>    }
> 
>    sort(dfs.begin(), dfs.end(), LocalityCompare);
> 
>    for(vector<pkgCache::DescFile *>::iterator dI = dfs.begin(); dI != dfs.end(); dI++) {
>       pkgRecords::Parser &P = Recs.Lookup(pkgCache::DescFileIterator(Cache, *dI));
>       RPackage * pkg = _lister->getPackage(P.Name());
> 
>       if(!_lister->lock()) return 0;
>       enabled = _lister->getAddLoaderEnabled();
>       if(enabled) {
>          pkg->setSummaryCache(P.ShortDesc());
>          pkg->setMaintainerCache(P.Maintainer());
>          pkg->setDescriptionCache(P.LongDesc());
>       }
>       if(!_lister->unlock()) return 0;
>    }
> 
>    _lister->setAddLoaded();
> 
>    nice(-19);
> 
>    //cache package database (.list files needed by dpkg)
> 
>    vector<string> files;
>    if(!get_files("/var/lib/dpkg/info", ".list", files)) return 0;
>    for(vector<string>::const_iterator fit = files.begin(); fit != files.end(); ++fit) {
>       bool enabled;
>       if(!_lister->lock()) return 0;
>       enabled = _lister->getAddLoaderEnabled();
>       if(!_lister->unlock()) return 0;
> 
>       if(!enabled) return 0;
> 
>       read_file(string("/var/lib/dpkg/info/") + *fit, 512);
>    }
> 
>    return 0;
> }
> 
> 
> bool get_files(const string &dir, const string &suffix, vector<string> &files) {
>    DIR *dp;
>    struct dirent *dirp;
>    if ((dp = opendir(dir.c_str())) == NULL) {
>       cerr << "Error(" << errno << ") opening " << dir << endl;
>       return false;
>    }
> 
>    while ((dirp = readdir(dp)) != NULL) {
>       string name = string(dirp->d_name);
>       if(name.length() < suffix.length()) continue;
>       if(name.substr(name.length() - suffix.length(), suffix.length()) == suffix)
>          files.push_back(name);
>    }
>    closedir(dp);
428a636,650
> 
> void read_file(const string &file_name, int block_size) {
>    ifstream file;
>    file.open(file_name.c_str(), ios::in | ios::binary);
>    if (file.is_open()) {
>       char * memblock = new char[block_size];
>       while (!file.eof()) {
>          file.read(memblock, block_size);
>       }
>       file.close();
>       delete[] memblock;
>    }
> }
> 
> 
575d796
<    _selectedView->refresh();
1461c1682
<     //              The first %s is the URL and the second 
---
>     //              The first %s is the URL and the second
1755,1759d1975
< void RPackageLister::refreshView()
< {
<    _selectedView->refresh();
< }
< 
diff -r synaptic-0.63clean/common/rpackagelister.h synaptic-0.63cleanPath/common/rpackagelister.h
37a38
> #include <pthread.h>
107a109,118
> // LocalitySort - Sort a version list by package file locality          /*{{{*/
> // ---------------------------------------------------------------------
> 
> bool LocalityCompare(const void * a, const void * b);
> 
> void * addloader(void * arg); //additional info thread loader
> bool get_files(const string &dir, const string &suffix, vector<string> &files);
> void read_file(const string &file, int block_size);
> 
> 
143a155,161
>    //additional package info loader (description, symmary, maintainer
>    pthread_t * _add_loader;
>    pthread_cond_t _add_cond;
>    pthread_mutex_t _add_mutex;
>    bool _add_enabled; //thread can run
>    bool _add_loaded;
> 
148c166,168
<    public:
---
> public:
> 
>    RPackageCache * cache() { return _cache; }
214c234,254
<    public:
---
>    bool lock(pthread_mutex_t * mutex);
>    bool unlock(pthread_mutex_t * mutex);
> 
> public:
> 
>    bool isCacheToReset() {
>       return _updating;
>    }
> 
>    bool getAddLoaderEnabled() {
>       return _add_enabled;
>    }
> 
>    bool lock() { return lock(&_add_mutex); }
>    bool unlock() { return unlock(&_add_mutex); }
> 
>    //additional package info load
>    bool setAddLoaded();
>    bool isAddLoaded();
>    bool waitAddLoaded();
> 
235,237d274
<    // refresh view 
<    void refreshView();
< 
308a346
>    void commitPackageStates();
diff -r synaptic-0.63clean/gtk/rgmainwindow.cc synaptic-0.63cleanPath/gtk/rgmainwindow.cc
105a106,107
>    _blockActions = TRUE;
> 
108c110
< 	       view, subView.size() > 0 ? subView.c_str() : "(empty)");
---
>                view, subView.size() > 0 ? subView.c_str() : "(empty)");
115d116
<    _blockActions = TRUE;
117a119
>    //this->setBusyCursor(true);
123,125c125
<    gtk_tree_view_set_model(GTK_TREE_VIEW(_treeView), NULL);
<       
<    RPackage *pkg = selectedPackage();
---
>    gtk_tree_view_set_model(GTK_TREE_VIEW(this->_treeView), NULL);
127d126
<    _lister->setView(view);
128a128,129
>    _lister->setView(view);
>    this->refreshTable(NULL, false);
130,158d130
< 
<    GtkTreeSelection* selection;
<    setBusyCursor(true);
<    setInterfaceLocked(TRUE);
<    GtkWidget *tview = glade_xml_get_widget(_gladeXML, "treeview_subviews");
<    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tview));
<    if(!subView.empty()) {
<       GtkTreeModel *model;
<       GtkTreeIter iter;
<       char *str;
< 
<       model = gtk_tree_view_get_model(GTK_TREE_VIEW(tview));
<       if(gtk_tree_model_get_iter_first(model, &iter)) {
<          do {
<             gtk_tree_model_get(model, &iter, 0, &str, -1);
<             if(strcoll(str, MarkupEscapeString(subView).c_str()) == 0) {
<                gtk_tree_selection_select_iter(selection, &iter);
<                break;
<             }
<          } while(gtk_tree_model_iter_next(model, &iter));
<       }
<    } else {
<       GtkTreePath * path = gtk_tree_path_new_from_string( "0" );
<       gtk_tree_selection_select_path( selection, path );
<    }
<    _lister->setSubView(subView);
<    refreshTable(pkg,false);
<    setInterfaceLocked(FALSE);     
<    setBusyCursor(false);
160d131
<    setStatusText();
518d488
<    me->_lister->refreshView();
657d626
< 
725d693
< 
787c755
<    : RGGladeWindow(NULL, name), _lister(packLister), _pkgList(0), 
---
>    : RGGladeWindow(NULL, name), _lister(packLister), _pkgList(0),
2006c1974
<    if (gtk_widget_has_focus (entry) && GPOINTER_TO_INT(data) == PKG_DELETE) {
---
>    if (GTK_WIDGET_HAS_FOCUS (entry) && GPOINTER_TO_INT(data) == PKG_DELETE) {
2478a2447,2466
> 
>       // we auto set to last search
>       GtkTreeModel *model;
>       GtkTreeSelection *selection;
>       GtkTreeIter iter;
>       char *buff;
> 
>       GtkWidget *view = glade_xml_get_widget(me->_gladeXML, "treeview_subviews");
>       model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
>       selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
>       if (gtk_tree_model_get_iter_first(model, &iter)) {
>          do {
>             gtk_tree_model_get(model, &iter, 0, &buff, -1);
>             if (strcoll(buff, str.c_str()) == 0) {
>                gtk_tree_selection_select_iter(selection, &iter);
>                break;
>             }
>          } while (gtk_tree_model_iter_next(model, &iter));
>       }
> 
2828d2815
< 
2883a2871
> 
2886a2875
> 
2925a2915
> 
2937d2926
< 
