After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765061 - Do not skip CoglError parameters
Do not skip CoglError parameters
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2016-04-14 15:26 UTC by Florian Müllner
Modified: 2016-04-15 16:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
st: Do not try to unref NULL CoglObjects (1.49 KB, patch)
2016-04-14 15:26 UTC, Florian Müllner
none Details | Review
Do not skip CoglError parameters (6.81 KB, patch)
2016-04-14 15:26 UTC, Florian Müllner
committed Details | Review
st: Do not try to unref NULL CoglObjects (1.69 KB, patch)
2016-04-15 15:50 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2016-04-14 15:26:04 UTC
Like bug 765058, but for the gnome-shell side.
Comment 1 Florian Müllner 2016-04-14 15:26:09 UTC
Created attachment 326020 [details] [review]
st: Do not try to unref NULL CoglObjects
Comment 2 Florian Müllner 2016-04-14 15:26:15 UTC
Created attachment 326021 [details] [review]
Do not skip CoglError parameters

While CoglError is a define to GError, it doesn't follow the convention
of ignoring errors when NULL is passed, but rather treats the error as
fatal :-(
That's clearly unwanted for a compositor, so make sure to always pass
an error parameter where a runtime error is possible
Comment 3 Rui Matos 2016-04-15 15:33:29 UTC
Review of attachment 326020 [details] [review]:

::: src/st/st-private.c
@@ +397,3 @@
   cogl_pipeline_set_layer_texture (pipeline, 0, texture);
+
+  if (texture)

I don't think cogl_pipeline_copy can fail unless we're OOM... In fact there are other places that don't check for NULL being returned from cogl_pipeline_new() calls

::: src/st/st-texture-cache.c
@@ +643,3 @@
       clutter_texture_set_cogl_texture (bind->texture, texdata);
+
+      if (texdata)

might as well skip the clutter call since that will just print a warning
Comment 4 Rui Matos 2016-04-15 15:39:46 UTC
Review of attachment 326021 [details] [review]:

::: src/st/st-theme-node-drawing.c
@@ +184,2 @@
   g_free (data);
   g_assert (texture != COGL_INVALID_HANDLE);

:-(
Comment 5 Florian Müllner 2016-04-15 15:44:08 UTC
(In reply to Rui Matos from comment #3)
>    cogl_pipeline_set_layer_texture (pipeline, 0, texture);
> +
> +  if (texture)
> 
> I don't think cogl_pipeline_copy can fail unless we're OOM... In fact there
> are other places that don't check for NULL being returned from
> cogl_pipeline_new() calls

The check is for the return value of cogl_texture_2d_new_from_data(), not cogl_pipeline_new/copy().


> ::: src/st/st-texture-cache.c
> +      if (texdata)
> 
> might as well skip the clutter call since that will just print a warning

OK.
Comment 6 Florian Müllner 2016-04-15 15:50:21 UTC
Created attachment 326113 [details] [review]
st: Do not try to unref NULL CoglObjects
Comment 7 Rui Matos 2016-04-15 16:19:55 UTC
Review of attachment 326113 [details] [review]:

lgtm

::: src/st/st-private.c
@@ +397,3 @@
   cogl_pipeline_set_layer_texture (pipeline, 0, texture);
+
+  if (texture)

right, I misread this before
Comment 8 Florian Müllner 2016-04-15 16:42:15 UTC
Attachment 326021 [details] pushed as 63f6ff9 - Do not skip CoglError parameters
Attachment 326113 [details] pushed as 59c2ace - st: Do not try to unref NULL CoglObjects