< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] DUM: death penalty for not calling setRegistrationPersistenceManager in ServerRegistration.cxx?


Having a registration persistence manager installed is a requirement to use ServerRegistrations.  This is a development error, so I think an assert is appropriate.

BTW:  Please avoid cross-posting to both devel and users lists.  In this case the devel list is more appropriate.  Thanks.  :)

Scott


On Fri, Jun 6, 2014 at 11:20 AM, John Gregg <jgregg@xxxxxxxxx> wrote:

Throughout ServerRegistration.cxx, there is a lot of code that uses a local variable, database, like this:

  RegistrationPersistenceManager *database = mDum.mRegistrationPersistenceManager;
...

  contacts = database->getContacts(mAor);
  database->unlockRecord(mAor);

This code will crash if database is NULL, that is, if mDum.mRegistrationPersistenceManager is NULL. The only way it ever gets set is for someone (i.e. the app) to call DialogUsageManager::setRegistrationPersistenceManager(). I'm not sure of the use of this, and maybe it simply doesn't make sense to be doing any registrations without having called this accessor first, but even in that case, perhaps the uses of it should assert or throw an exception instead of just assuming the pointer is valid and using it. For my purposes, I simply wrapped all uses of database in "if (database) ..." which may not be the absolutely correct thing to do. I can post or email the diffs as directed if you all think what I did is appropriate. Otherwise, I just thought I'd mention it.

regards,

-John Gregg

_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@resiprocate.org
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel