[sigc] How to be called back when a disconnection occur ?



Here's my problem :
I've got a signal contained into a class 'AsynchronousJobHandler'.
I've got clients of "AsynchronousJobHandler" that ask it to do so some
asynchronous job on an identified resource.

class AsynchronousJobHandler
{
public :
  void doJob(Resource r, sigc::slot_type slot);
private :
  sigc::signal<...> mySignal;
};

class SomeClient : public sigc::trackable
{
public :
  void f(AsynchronousJobHandler& async);
};

So basically, while processing I've got something like :

void SomeClient::f(AsynchronousJobHandler& async)
{
  async.doJob(MyResource, sigc::mem_fun(*this, &SomeClient::callback));
}

Then my AsynchronousJobHandler does something and later callbacks all
clients registered on resource.
AsynchronousJobHandler is also able to react to other events and restart
the job automatically so that client keeps up to date without reasking
explicitly for the job to be done.

Then later, the client is destroyed.
AsynchronousJobHandler::mySignal is correctly updated.
The problem is AsynchronousJobHandler has allocated resources, and has
registered to other events to do the job.
I'd like it to be notified a slot is being removed from its signal so that
it can also clean up its internal resources.

How to do it ?

Temporarily, I've modified the doJob() function to add another extra
argument of type sigc::trackable and I have called
add_destroy_notify_callback() so that AsynchronousJobHandler is notified.
However, as I'm passing the slot, I should be able to access the pointed
trackable object and/or sigc::connection objects directly but I do not know
how to do it.

I've dived in the source, and I've seen the functor_ is owned by the
typed_slot_rep but it is not easily accessible...

Any idea of how to do it ?

Kind regards

David


This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]