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 765576 - gtk+ leaks and hangs
gtk+ leaks and hangs
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-04-26 07:31 UTC by Christoph Reiter (lazka)
Modified: 2016-04-26 09:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdk: Ensure resources registration happens once (1.14 KB, patch)
2016-04-26 08:10 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Christoph Reiter (lazka) 2016-04-26 07:31:25 UTC
Cause https://git.gnome.org/browse/gtk+/commit/?id=55537cccbd8129ed9fd3d00e8af07c05719516ac

-------

#include <gtk/gtk.h>

/* gcc -Wall `pkg-config --cflags --libs gtk+-3.0` a.c */

int main(int argc, char *argv[]) {
  GtkWidget *window;

  gdk_init (&argc, &argv);
  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_show_all (window);

  gtk_main();

  return 0;
}

-----

Before trying the above I recommend "sudo swapoff -a", or your machine will swap immediately.

The cause is calling gdk_init() before gtk_init() and somehow results in gresource.c:lazy_register_resources() looping forever.
Comment 1 Emmanuele Bassi (:ebassi) 2016-04-26 08:10:59 UTC
Created attachment 326728 [details] [review]
gdk: Ensure resources registration happens once

Like GTK does it.
Comment 2 Christoph Reiter (lazka) 2016-04-26 09:26:16 UTC
Review of attachment 326728 [details] [review]:

This fix make things work again.

::: gdk/gdk.c
@@ +273,3 @@
+register_resources (void)
+{
+  _gdk_register_resources ();

s/_gdk_register_resources/_gdk_register_resource/
Comment 3 Emmanuele Bassi (:ebassi) 2016-04-26 09:37:22 UTC
Thanks for the review, and for catching the typo.

Attachment 326728 [details] pushed as 0e14456 - gdk: Ensure resources registration happens once