[mono/gtk-sharp] [2 commits] e9d5d180: glib: install properties before class_init finishes

"Bertrand Lorentz ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141e1ab6d4a-7d3895c4-2773-490d-af82-845926ad096c-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/gtk-sharp
  Compare: https://github.com/mono/gtk-sharp/compare/2022141ddd5c...a4c42994e8af

   Commit: e9d5d1803d73ee1183c6af5c1587f129b90e9608
   Author: Andrés G. Aragoneses <[email protected]> (knocte)
     Date: 2013-10-20 22:37:29 GMT
      URL: https://github.com/mono/gtk-sharp/commit/e9d5d1803d73ee1183c6af5c1587f129b90e9608

glib: install properties before class_init finishes

Recently glib started to warn about the future deprecation of adding
interfaces after class_init, which we fixed here [1].

Now, a similar warning has started to happen for the addition of
properties, example:

(Nereid:23225): GLib-GObject-WARNING **: Attempt to add property __gtksharp_33_Banshee_Widgets_TileView::gtk-sharp-managed-instance after class was initialised

So we need to add them before class_init finishes too, and this
change makes it this way.

[1] https://github.com/mono/gtk-sharp/commit/9ff7ec8b2c6a1727f61601bd934d65a790f5adda

Changed paths:
  M glib/Object.cs

Modified: glib/Object.cs
===================================================================
@@ -206,7 +206,6 @@ internal GType Init ()
 				AddGInterfaces ();
 				gtype.EnsureClass (); //calls class_init
 
-				AddProperties ();
 				ConnectDefaultHandlers ();
 				InvokeTypeInitializers ();
 				AddInterfaceProperties ();
@@ -242,6 +241,8 @@ private void ClassInit (IntPtr gobject_class_handle)
 				foreach (GInterfaceAdapter adapter in adapters) {
 					InitializeProperties (adapter, gobject_class_handle);
 				}
+
+				AddProperties (gobject_class_handle);
 			}
 
 			private void InitializeProperties (GInterfaceAdapter adapter, IntPtr gobject_class_handle)
@@ -288,12 +289,11 @@ private void OverrideHandlers (IntPtr gobject_class_handle, bool ctor, bool prop
 				HandlersOverriden = true;
 			}
 
-			void AddProperties ()
+			void AddProperties (IntPtr gobject_class_handle)
 			{
 				if (is_first_subclass) {
-					IntPtr declaring_class = gtype.GetClassPtr ();
 					ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly);
-					g_object_class_install_property (declaring_class, idx, pspec.Handle);
+					g_object_class_install_property (gobject_class_handle, idx, pspec.Handle);
 					idx++;
 				}
 

   Commit: a4c42994e8afd83192518e460938f3991d3f64de
   Author: Bertrand Lorentz <[email protected]> (bl8)
     Date: 2013-10-22 19:34:45 GMT
      URL: https://github.com/mono/gtk-sharp/commit/a4c42994e8afd83192518e460938f3991d3f64de

Merge pull request #81 from knocte/properties_class_init

glib: install properties before class_init finishes

Changed paths:
  M glib/Object.cs

Modified: glib/Object.cs
===================================================================
@@ -206,7 +206,6 @@ internal GType Init ()
 				AddGInterfaces ();
 				gtype.EnsureClass (); //calls class_init
 
-				AddProperties ();
 				ConnectDefaultHandlers ();
 				InvokeTypeInitializers ();
 				AddInterfaceProperties ();
@@ -242,6 +241,8 @@ private void ClassInit (IntPtr gobject_class_handle)
 				foreach (GInterfaceAdapter adapter in adapters) {
 					InitializeProperties (adapter, gobject_class_handle);
 				}
+
+				AddProperties (gobject_class_handle);
 			}
 
 			private void InitializeProperties (GInterfaceAdapter adapter, IntPtr gobject_class_handle)
@@ -288,12 +289,11 @@ private void OverrideHandlers (IntPtr gobject_class_handle, bool ctor, bool prop
 				HandlersOverriden = true;
 			}
 
-			void AddProperties ()
+			void AddProperties (IntPtr gobject_class_handle)
 			{
 				if (is_first_subclass) {
-					IntPtr declaring_class = gtype.GetClassPtr ();
 					ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly);
-					g_object_class_install_property (declaring_class, idx, pspec.Handle);
+					g_object_class_install_property (gobject_class_handle, idx, pspec.Handle);
 					idx++;
 				}
 
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.