[gnome-builder] xml-pack: check pointer comparison before unref
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] xml-pack: check pointer comparison before unref
- Date: Tue, 12 Jun 2018 04:39:21 +0000 (UTC)
commit 940751393f6c92a5e26e25156892951c96e33155
Author: Christian Hergert <chergert redhat com>
Date: Mon Jun 11 21:37:56 2018 -0700
xml-pack: check pointer comparison before unref
Make sure we don't unref/ref if the pointers are the same.
src/plugins/xml-pack/ide-xml-analysis.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/xml-pack/ide-xml-analysis.c b/src/plugins/xml-pack/ide-xml-analysis.c
index 016064be0..1f616d289 100644
--- a/src/plugins/xml-pack/ide-xml-analysis.c
+++ b/src/plugins/xml-pack/ide-xml-analysis.c
@@ -79,8 +79,11 @@ ide_xml_analysis_set_diagnostics (IdeXmlAnalysis *self,
g_return_if_fail (self != NULL);
g_return_if_fail (diagnostics != NULL);
- g_clear_pointer (&self->diagnostics, ide_diagnostics_unref);
- self->diagnostics = ide_diagnostics_ref (diagnostics);
+ if (diagnostics != self->diagnostics)
+ {
+ g_clear_pointer (&self->diagnostics, ide_diagnostics_unref);
+ self->diagnostics = ide_diagnostics_ref (diagnostics);
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]