diff options
Diffstat (limited to 'core/polkit-tqt-subject.cpp')
-rw-r--r-- | core/polkit-tqt-subject.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/core/polkit-tqt-subject.cpp b/core/polkit-tqt-subject.cpp index 1fa8d710f..3d9e99b7a 100644 --- a/core/polkit-tqt-subject.cpp +++ b/core/polkit-tqt-subject.cpp @@ -42,17 +42,26 @@ class Subject::Data : public TQShared Data(const Data &other) : subject(other.subject) { - g_object_ref(subject); + if (subject) + { + g_object_ref(subject); + } } Data(PolkitSubject *_subject) : subject(_subject) { - g_object_ref(subject); + if (subject) + { + g_object_ref(subject); + } } ~Data() { - g_object_unref(subject); + if (subject) + { + g_object_unref(subject); + } } PolkitSubject *subject; @@ -111,9 +120,15 @@ void Subject::setSubject(PolkitSubject *subject) { if (d->subject != subject) { - g_object_unref(d->subject); + if (d->subject) + { + g_object_unref(d->subject); + } d->subject = subject; - g_object_ref(subject); + if (d->subject) + { + g_object_ref(d->subject); + } } } |