Discussion:
[Glade-devel] A (not so) little issue at gladeui/glade-project.c:1492
Juan Manuel Mouriz
2015-02-19 17:41:58 UTC
Permalink
To Glade developers

In gladeui/glade-project.c:1492, the call to g_free (required_lib) not
always leave required_lib in NULL, at least for me, so the condition
!required_lib fail in the remaining bucles. Of cource, this occurs when I
use more than one requires-tag and can't use my own plugins.

I believe that the more simple solution is to assign required_lib to NULL
just after g_free.

What they think about it?

Regards,

Juan Manuel
<glade-***@lists.ximian.com>
Johannes Schmid
2015-02-20 07:32:12 UTC
Permalink
Hi Juan!
Post by Juan Manuel Mouriz
In gladeui/glade-project.c:1492, the call to g_free (required_lib) not
always leave required_lib in NULL, at least for me, so the condition !
required_lib fail in the remaining bucles. Of cource, this occurs when
I use more than one requires-tag and can't use my own plugins.
I don't fully see your point. required_lib is free'd in the last else
branch and when the loop continues, the first thing is to initialize it
to NULL
(https://git.gnome.org/browse/glade/tree/gladeui/glade-project.c#n1443).
So it shouldn't be a problem that it isn't being set to NULL.

Sidenote: The correct way to free it and set it to NULL would be
g_clear_pointer (&required_lib, g_free) but that shouldn't be necessary
here.


Regards,
Johannes
Juan Manuel Mouriz
2015-02-21 01:03:45 UTC
Permalink
Thanks Johannes,

I'm sorry, I made the mistake of watching a previous version and I see that the
code it's ok in GIT.

Thank you very much for pointing the correct way to free.
Post by Johannes Schmid
Hi Juan!
Post by Juan Manuel Mouriz
In gladeui/glade-project.c:1492, the call to g_free (required_lib) not
always leave required_lib in NULL, at least for me, so the condition !
required_lib fail in the remaining bucles. Of cource, this occurs when
I use more than one requires-tag and can't use my own plugins.
I don't fully see your point. required_lib is free'd in the last else
branch and when the loop continues, the first thing is to initialize it
to NULL
(https://git.gnome.org/browse/glade/tree/gladeui/glade-project.c#n1443).
So it shouldn't be a problem that it isn't being set to NULL.
Sidenote: The correct way to free it and set it to NULL would be
g_clear_pointer (&required_lib, g_free) but that shouldn't be necessary
here.
Regards,
Johannes
Loading...