On Sunday 29 October 2000 19:08, Dawit Alemayehu wrote: > > Hello, > > I am trying to add support for automatic deletion of passwords when the > applications that cached them are closed by the user. To achieve this I > put the code that tracks and deletes cached passwords in KIO's scheduler > since there is one instance of it per app (unlike the slaves and the jobs). > Hence, when the app exists we are able to correctly deal with the cached > passwords (remove them as necessary). However, I cannot get this to work > no matter what I tried and need help. From what I gathered so far it seems > to me that my problem stems from the fact that the scheduler is a static > object. I have attached a patch below to show what I have done. Below is > a brief description of how this deletion is supposed(intended) to work: > > 1.) Whenever a unique new password is cached the SlaveBase responsible for > this stuff sends a message to the application-side of the house > (SlaveInterface). The message is the key under which the password is > cached in the kdesud daemon. > > 2.) When the SlaveInterface gets this message it emits a signal with this > key at hand. And since the scheduler is connected to this signal when it > first created the io-slave, it gets its hand on it. > > 3) The SLOT connected to the signal in KIO::Scheduler then store the key in > a list (QValueList) and registers itself with the kdesu daemon as an owner > of this key. > > So far so good. I was able to get this to work for a while consistently, > but now for whatever reason it seems not to anymore. I do not get the > debug statements I should when I test it. But do not worry about this as > it seems to be something wrong on my end > > 4.) When the application is then destroyed, I put a statement that calls > delCachedAuthKeys in KIO::Scheduler's dtor. The above method determines > whether or not the cached entries should be deleted or not. This is the > point of failure. I always get the following FATAL error and konqueror > aborts in the process of shutting down. > > Fatal error: you need to have a KInstance object before > you do anything that requires it! Examples of this are config > objects, standard directories or translations. > zsh: 9755 abort konqueror > > If I then remove the method that attempts to call the afformentioned method > from the destructor, I do not get the above message. > > Thus, the question is where is the correct place to put this stuff such > that when this static object is destroyed or about to be destroyed the > cached entries, if any, can be cleaned as well... The scheduler gets deleted after the KApplication gets deleted, there isn't a whole lot of stuff you are allowed to do at that point. It's like a house that falls apart and you are running for the door.... Cheers, Waldo -- KDE/Linux, you make the choice.