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 746647 - leak fixes in egl-kms cogl backend
leak fixes in egl-kms cogl backend
Status: RESOLVED OBSOLETE
Product: cogl
Classification: Platform
Component: EGL
unspecified
Other All
: Normal normal
: ---
Assigned To: Cogl maintainer(s)
Cogl maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-03-23 14:02 UTC by Ray Strode [halfline]
Modified: 2021-06-10 11:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
kms-winsys: fix leaks in _cogl_winsys_egl_display_setup (7.42 KB, patch)
2015-03-23 14:03 UTC, Ray Strode [halfline]
needs-work Details | Review
kms-winsys: fix another leak in _cogl_winsys_egl_display_setup (2.27 KB, patch)
2015-03-23 14:03 UTC, Ray Strode [halfline]
accepted-commit_now Details | Review

Description Ray Strode [halfline] 2015-03-23 14:02:02 UTC
+++ This bug was initially created as a clone of Bug #746042 +++

Ray Strode [halfline] [reporter] [developer] 2015-03-20 14:11:32 EDT

Created attachment 299976 [details] [review] [review]
kms-winsys: fix leaks in _cogl_winsys_egl_display_setup

The code fails to free up the display when setup fails.

[reply] [−] Comment 13 Ray Strode [halfline] [reporter] [developer] 2015-03-20 14:11:39 EDT

Created attachment 299977 [details] [review] [review]
kms-winsys: fix another leak in _cogl_winsys_egl_display_setup

The code fails to free up the drmModeRes structure it queries for.

 Rui Matos [developer] 2015-03-23 09:03:23 EDT

Review of attachment 299976 [details] [review] [review]:

What I'd really like to see is removing the ad-hoc output initialization (mirror, etc) that's not really needed.

::: cogl/winsys/cogl-winsys-egl-kms.c
@@ +655,2 @@
   if (!output0)
+    goto out;

This one was clearly wrong since we would crash later in output_free() when called from _display_destroy()

@@ +744,3 @@
+        output_free (kms_renderer->fd, output1);
+
+      _cogl_winsys_egl_display_destroy (display);

This call seems wrong though. If this function returns FALSE, the calling code in cogl_context_new() does cogl_object_unref (display) which, IIUC, ends up doing winsys->display_destroy(), i.e. the calling code is responsible to destroy this object, not us.

[reply] [−] Comment 20 Rui Matos [developer] 2015-03-23 09:04:25 EDT

Review of attachment 299977 [details] [review] [review]:

right

 Ray Strode [halfline] [reporter] [developer] 2015-03-23 09:57:29 EDT

(In reply to Rui Matos from comment #19)
> Review of attachment 299976 [details] [review] [review] [review]:
> 
> What I'd really like to see is removing the ad-hoc output initialization
> (mirror, etc) that's not really needed.
Alright let's move discussion to a new bug, the only reason these fixes snuck into this bug was because I was going to use the leaked resources object for vblank handling. now we're not doing the vblank handling, so the leak fixes are pretty independent of this bug.  will clone.

> This call seems wrong though. If this function returns FALSE, the calling
> code in cogl_context_new() does cogl_object_unref (display) which, IIUC,
> ends up doing winsys->display_destroy(), i.e. the calling code is
> responsible to destroy this object, not us.
Indeed, reading fail there. before deciding to put the destroy call in I read the top half of the function, and decided it was idempotent.  of course the bottom half of the function isn't...
Comment 1 Ray Strode [halfline] 2015-03-23 14:02:33 UTC
For convenience will reattach patches here
Comment 2 Ray Strode [halfline] 2015-03-23 14:03:25 UTC
Created attachment 300136 [details] [review]
kms-winsys: fix leaks in _cogl_winsys_egl_display_setup

The code fails to free up the display when setup fails.

https://bugzilla.gnome.org/show_bug.cgi?id=746042
Comment 3 Ray Strode [halfline] 2015-03-23 14:03:31 UTC
Created attachment 300137 [details] [review]
kms-winsys: fix another leak in _cogl_winsys_egl_display_setup

The code fails to free up the drmModeRes structure it queries for.

https://bugzilla.gnome.org/show_bug.cgi?id=746042
Comment 4 Ray Strode [halfline] 2015-03-23 14:04:20 UTC
Comment on attachment 300137 [details] [review]
kms-winsys: fix another leak in _cogl_winsys_egl_display_setup

(marking a-c-n since the patch was reviewed in the parent bug )
Comment 5 Ray Strode [halfline] 2015-03-23 14:04:58 UTC
Comment on attachment 300136 [details] [review]
kms-winsys: fix leaks in _cogl_winsys_egl_display_setup

(marking needs-work since the patch still needs the fixes and potential changes mentioned in the parent bug)
Comment 6 André Klapper 2021-06-10 11:20:22 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version of cogl, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a ticket at
  https://gitlab.gnome.org/GNOME/cogl/-/issues/

Thank you for your understanding and your help.