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 618750 - Creating a Gtk.Window with GLib.Object.new is broken
Creating a Gtk.Window with GLib.Object.new is broken
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator: GObject
0.8.x
Other Linux
: Urgent blocker
: ---
Assigned To: Vala maintainers
Vala maintainers
wrong-code test-case trivial-patch
Depends on:
Blocks:
 
 
Reported: 2010-05-15 22:51 UTC by Evan Nemerson
Modified: 2010-08-20 07:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (153 bytes, text/plain)
2010-05-15 22:51 UTC, Evan Nemerson
  Details
Fix ref-sink GLib.InitiallyUnowned created with Object.new. (1.61 KB, patch)
2010-08-08 19:46 UTC, Luca Bruno
none Details | Review

Description Evan Nemerson 2010-05-15 22:51:42 UTC
Created attachment 161145 [details]
test case

The return value of g_object_new (GTK_TYPE_WINDOW, "type", GTK_WNDOW_TOPLEVEL, NULL) apparently needs to have g_object_ref_sink called on it, but that isn't happening because the result of the generated g_object_is_floating call is false.

Running the attached test case will show the problem, but if you tweak the generated C so that g_object_ref_sink is called, everything seems to work.
Comment 1 Luca Bruno 2010-08-08 17:19:07 UTC
A way to fix this is to check whether a type is subclass of InitiallyUnowned instead of using g_object_is_floating. Any thoughts?
Comment 2 zarevucky.jiri 2010-08-08 17:46:14 UTC
Isn't that a GTK bug?
Comment 3 Luca Bruno 2010-08-08 19:46:52 UTC
Created attachment 167377 [details] [review]
Fix ref-sink GLib.InitiallyUnowned created with Object.new.

Fixes bug 618750.
Comment 4 Jürg Billeter 2010-08-20 07:44:45 UTC
commit 583c88c1ab05c86753405a658a61e1939d026f1b
Author: Luca Bruno <lethalman88@gmail.com>
Date:   Fri Aug 20 09:39:23 2010 +0200

    Fix ref_sink of Gtk.Window created with GLib.Object.new
    
    Fixes bug 618750.