|
@@ -51,7 +51,7 @@ ctkServiceRegistration::ctkServiceRegistration(const ctkServiceRegistration& reg
|
|
|
ctkServiceRegistration::ctkServiceRegistration(ctkServiceRegistrationPrivate* registrationPrivate)
|
|
|
: d_ptr(registrationPrivate)
|
|
|
{
|
|
|
- d_func()->ref.ref();
|
|
|
+ if(d_func()) d_func()->ref.ref();
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
@@ -202,7 +202,8 @@ void ctkServiceRegistration::unregister()
|
|
|
d->plugin = 0;
|
|
|
d->dependents.clear();
|
|
|
d->service = 0;
|
|
|
- d->serviceInstances.clear();;
|
|
|
+ d->serviceInstances.clear();
|
|
|
+ d->reference = 0;
|
|
|
d->unregistering = false;
|
|
|
}
|
|
|
}
|
|
@@ -228,7 +229,7 @@ ctkServiceRegistration& ctkServiceRegistration::operator=(const ctkServiceRegist
|
|
|
{
|
|
|
ctkServiceRegistrationPrivate* curr_d = d_func();
|
|
|
d_ptr = registration.d_ptr;
|
|
|
- d_ptr->ref.ref();
|
|
|
+ if (d_ptr) d_ptr->ref.ref();
|
|
|
|
|
|
if (curr_d && !curr_d->ref.deref())
|
|
|
delete curr_d;
|