This avoids unnecessary work, and prevents the IntPtr from being
freed when assigned to itself.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
GLib 2.32 has been released in March 2012, so we can now require it a
build and run time. This allows us to remove GLib 2.31 conditionals,
mark the Thread.Init as obsolete, and remove all references to
libgthread.
Please note that the API exposed in glib and gio is still from 2.28, but
we will have some API additions in the future. First example is the next
commit, which brings GBytes, an addition in GLib 2.32.
If the StructLayout is not set, StructureToPtr will throw an exception.
In these cases the type is probably wrapped using a handle and thus
needs no update.
In Cairo there the default constructor does not take a ref to the native
object making the object invalid when trying to access it.
This commit changes the behaviour to search for another constructor that
takes an owner variable which is set to false when invoked to indicate
that the managed side should take a ref.
When an instance of SourceProxy was finalized, we would try to remove
the corresponding source, even if it was already removed. This now
causes native GLib to print out warnings because it can't find the
source ID.
Now Source.Remove only calls g_source_remove if we really had a handler
registered for the ID we're removing.
Turn Source.source_handlers into a private generic Dictionary, and add
the necessary methods to allow Idle and Timeout to add and remove
entries from it.
This improves the encapsulation of the Source class, and factors
into it some code that was previously duplicated in Idle and Timeout.
Move stuff around to have them in a reasonable order: fields, then
constructors, then destructor, then static methods, then instance stuff.
Also remove a commented out method, which would not be correct anyway.
No real code change here, just cosmetic changes.
This allows you to avoid ugly calls like "NewArray (null, some_array)"
when you want the child type to be determined by the first element of
the children array.
Also throw specific exceptions when both type and children parameters
would be null.
On Windows with MinGW, csc.exe is confused by paths like
"../AssemblyInfo.cs", so we need some trickery to have something that
works on both Linux and Windows.
This isn't pretty, but it's the best solution I could find right now.
The other approach would have been to go back to copying AssemblyInfo.cs
around, but that has it's own set of issues.
On Windows, gacutil.exe is often installed in a path with spaces, like
"C:\Program Files...". This causes problem when trying to call it during
"make install". Enclosing in double quotes fixes this, and has no impact
on Linux.
This way there's less redundancy, and if the library name changes in the
future, it will be changed only in one place.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
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] 9ff7ec8b2c
There is no null check after these casts so if they fail they would
generate a NullReferenceException. By changing them to static casts
we would get a InvalidCastException which are much less misleading.
In the same way all GLib.Object-derived classes provided by the
generator have a GType static property (i.e. Gtk.Widget), we need
the same for the *Adapter classes, to access their GType without having
an instance of it. (The first use case would be GStreamerSharp's
Gst.Bin.IterateAllByInterface ().)
For this, we cannot simply add the property to all adapter classes
and be done, because it would clash with a property which is already
there, but is non-static, that has the same name and same value
(this property is needed for complying GInterfaceAdapter abstract
class), so we rename this property to GInterfaceGType because
using this name for the static one would not be consistent with the
rest of the classes generated which already provide the static one
with the name "GType".
The implementation of FindClassProperty() was the same as the
implementation of FindInterfaceProperty(), both receiving an iface
instead of a GObjectClass* [1].
The reason of this oversight can well be explained by the fact that
FindClassProperty() is private and not used, actually. However, we
may need it soonish as a good bind to g_object_class_find_property.
[1] https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-class-find-property
GSource type was already there (but was not mapped by
the generator yet) so then the autogenerated methods
have been added manually inside the class after the
custom methods.
Other Source-related class are also generated and added
(but not mapped in the SymbolTable) to glib.
This means that we're modifying the generated code that
we checked in, so then we increase the future TODO about
more information about what we need to fix later.
The changes to Cond are a consequence of the changes to
Mutex because the former uses the latter.