Commit Graph

33 Commits

Author SHA1 Message Date
Bertrand Lorentz
32d10bd319 Use GLib.Marshaller.Free instead of calling g_free directly
Using the GLib.Marshaller.Free method means we don't need to have the
g_free function definition duplicated all over the place.
2013-11-17 16:20:02 +01:00
Andrés G. Aragoneses
f1005da47c glib: Make all DllImports in custom code use a common const
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>
2013-11-17 13:05:12 +01:00
Andrés G. Aragoneses
6f16031661 glib: fix NRE regression after interface naming changed
ListBase was throwing a NullReferenceException in DataMarshal() due
to the fact that Reflection was being used to find the adapter name
of the interface generated by the bindings, which has recently
changed [1].

[1] 6cb03440c1
2013-08-24 00:11:05 +02:00
Bertrand Lorentz
ab61fbccbd glib: Fix crash when freeing lists with elements typed as interfaces
If a GList or a GSList had its element type set to a GInterface, and if
the elements were marked as owned, it would end up freeing those
elements with g_free(), which would lead to a crash.

They need to be unreffed with g_object_unref, but the criteria for that
was whether the element type is assignable to GLib.Object. This is not
true for GInterface types.

We now first check if the element type is an opaque. If not, and if it's
assignable to GLib.IWrapper, we then use g_object_unref.

From what I can see, all GLib.IWrapper subclasses that not opaque can be
unreffed with g_object_unref.
2012-11-18 16:06:34 +01:00
Christian Hoff
7b752d233c 2009-09-03 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Kill the calling convention field again.
	It breaks GLib 2.x compatibility in the generator and there is
	probably no need to make the calling convention configurable.
	* .cs, *.custom: Hardcode Cdecl calling convention instead of
	using GLib's field.

svn path=/trunk/gtk-sharp/; revision=141283
2009-09-03 19:50:53 +00:00
Christian Hoff
58e97c087a 2009-09-02 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Add a public constant field specifying the
	calling convention used by GLib and depending libraries.
	By now it's hardcoded to Cdecl as every non-Win32 runtime
	should ignore this attribute.
	* *.cs, *.custom: Use GLib.Global.CallingConvention for both
	pinvokes and callbacks. Plugs a stack leak on Win32. All
	pinvokes defaulted to StdCall and thus the stack was never
	cleaned up.

svn path=/trunk/gtk-sharp/; revision=141175
2009-09-02 20:17:37 +00:00
Mike Kestner
edf5b066e1 2009-04-09 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs: fix g_object_unref dllimport lib.
	[Fixes #493128]

svn path=/trunk/gtk-sharp/; revision=131388
2009-04-09 14:38:16 +00:00
Mike Kestner
89afb3f49f 2008-12-19 Mike Kestner <mkestner@novell.com>
* generator/BoxedGen.cs: don't generate glue dependencies.
	* glib/*.cs: remove glibsharpglue usage except thread.c.
	* glib/glue/*.c: kill all but thread.c. need glib 2.20 to kill
	it eventually.
	* pango/Attr*.cs: kill glue usage.
	* pango/glue/*.c: kill all but generated.c. it's next.
	* gtk/TreeIter.custom: kill a dumb glibsharpglue usage.

svn path=/trunk/gtk-sharp/; revision=121880
2008-12-19 18:57:42 +00:00
Stephane Delcroix
e7a4cbea59 2008-10-27 Stephane Delcroix <sdelcroix@novell.com>
* glib/ListBase.cs: DataMarshal: create the right object for *Adapter
	list items.

svn path=/trunk/gtk-sharp/; revision=117169
2008-10-27 15:08:02 +00:00
Andrés G. Aragoneses
76c808b7cb Cosmetic: spaces to tabs and coding guidelines
svn path=/trunk/gtk-sharp/; revision=113403
2008-09-18 11:34:15 +00:00
Mike Kestner
f956b09858 2007-08-14 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs : add AllocNativeElement method and an
	Append (object) method that uses it.
	* glib/List.cs : add object[] ctor using new append method.
	* glib/SList.cs : add object[] ctor using new append method.
	These are needed to return G(S)List* values as virtual method
	return values.

svn path=/trunk/gtk-sharp/; revision=84112
2007-08-14 18:53:53 +00:00
Mike Kestner
16fef6601b 2006-03-27 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs : deal with ownership of Opaque elements.
	* glib/Marshaller.cs : add a hack to deal with Opaque ownership in
	ListToArray marshaling.

svn path=/trunk/gtk-sharp/; revision=58609
2006-03-27 18:35:08 +00:00
Mike Kestner
eddfdc7910 2005-06-23 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs : support owned and elements_owned for lists.
	* glib/List.cs : add ctor overloads for memory mgmt.
	* glib/ListBase.cs : add ctor overloads for memory mgmt. Dispose
	elements if specified.
	* glib/SList.cs : add ctor overloads for memory mgmt.
	* gnome/Gnome.metadata : unhide and generate a List prop.
	* gnomevfs/Gnomevfs.metadata : unhide and generate a List prop.
	* gtk/FileChooser.custom : new. add hidden props.
	* gtk/FileChooserButton.custom : new. impl hidden props.
	* gtk/FileChooserDialog.custom : remove some List props and use the
	GLib.Marshaller for the remaining ones..
	* gtk/FileChooserWidget.custom : remove some List props and use the
	GLib.Marshaller for the remaining ones..
	* gtk/Gtk.metadata : unhide and let the generator do some List props.

svn path=/trunk/gtk-sharp/; revision=46457
2005-06-23 22:28:06 +00:00
Mike Kestner
463618c958 2005-06-08 Mike Kestner <mkestner@novell.com>
* generator/SimpleBase.cs : off-by-one in namespace join.
	* glib/ListBase.cs : support IntPtr element_type.
	* gnomevfs/FileInfo.cs : make it ManualGen friendly.
	* gnomevfs/*.cs : rework for FileInfo api changes.
	* gnomevfs/Gnomevfs.metadata : make FileInfo a manual symbol.
	* gnomevfs/Uri.custom : rework for FileInfo api changes.
	* gnome/Makefile.am : add gnomevfs dependency to pick up some more api
	symbols.
	* gnome/gnome-sharp-2.0.pc.in : advertise the vfs dep.
	[Fixes #71060]

svn path=/trunk/gtk-sharp/; revision=45702
2005-06-09 14:27:48 +00:00
Mike Kestner
e24d72317a 2005-06-08 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs : don't write a sem in FromNative.
	* glib/ListBase.cs : handle GLib.Object explicit element types.
	* glib/Marshaler.cs : only copy lists if Count > 0.
	* gtk/Gtk.metadata : unhide Window.ListToplevels with a proper element
	type for automatic list to array marshaling.
	* gtk/Window.custom : kill manual ListToplevels impl.

svn path=/trunk/gtk-sharp/; revision=45654
2005-06-08 17:29:48 +00:00
Mike Kestner
ff096ac998 2005-06-02 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs : add a nested class to support filename encoded
	string element marshaling.
	* gtk/Gtk.metadata : mark the filenames and folders as filename
	encoded.
	* gtk/FileChooserDialog.custom : use new ListBase.FilenameString type
	for list element type of filenames and folders.
	* gtk/FileChooserWidget.custom : use new ListBase.FilenameString type
	for list element type of filenames and folders.
	[Fixes #72701]

svn path=/trunk/gtk-sharp/; revision=45334
2005-06-02 16:16:28 +00:00
Mike Kestner
90a870e2de 2005-03-08 Mike Kestner <mkestner@novell.com>
* */*.cs : scrub for StringToPtrAnsi and string usage in DllImports.
	* */*.custom : begin the scrub here too.
	* generator/ConstStringGen.cs : implement IManualMarshaler and move to
	100% IntPtr marshaling.
	* generator/Ctor.cs : call Body.Finish too.
	* generator/IManualMarshaler.cs : new interface for generatables that
	marshal manually and need cleanup.
	* generator/Makefile.am : new file.
	* generator/MethodBody.cs : use IManualMarshaler if applicable.

svn path=/trunk/gtk-sharp/; revision=41579
2005-03-08 21:28:08 +00:00
Todd Berman
532947448e 2004-11-04 Todd Berman <tberman@off.net>
* glib/ListBase.cs: In Empty, call FreeList, not Dispose.

svn path=/trunk/gtk-sharp/; revision=35665
2004-11-04 20:01:40 +00:00
Todd Berman
838882b81a 2004-11-04 Todd Berman <tberman@off.net>
* glib/ListBase.cs: Make sure to properly check if it is a
        GLib.Object subclass.

svn path=/trunk/gtk-sharp/; revision=35654
2004-11-04 19:43:10 +00:00
Todd Berman
cac3c4a368 2004-11-04 Todd Berman <tberman@off.net>
* doc/en/GLib/ListBase.xml: Add documentation for ListBase.Empty
        * glib/ListBase.cs: Add ListBase.Empty, frees the children and the
        list.
        * glib/Markup.cs: Fix Alex's tomboy crash, sending -1 instead of
        Length.
        * gtk/FileChooserDialog.custom:
        * gtk/FileChooserWidget.custom: properly free the list.

svn path=/trunk/gtk-sharp/; revision=35650
2004-11-04 19:29:01 +00:00
Mike Kestner
b6bd5a901a 2004-08-30 Tambet Ingo <tambet@ximian.com>
* glib/ListBase.cs : indexing bugfix for CopyTo.

svn path=/trunk/gtk-sharp/; revision=33038
2004-08-30 13:10:44 +00:00
Mike Kestner
652b7fc82f remove a bunch of doc comments
svn path=/trunk/gtk-sharp/; revision=30951
2004-07-09 15:25:39 +00:00
Mike Kestner
7a6d6b2128 2004-06-25 Mike Kestner <mkestner@ximian.com>
* */*.cs : add lgpl license blurb and clean up (c)'s.
	* */*.custom : add lgpl license blurb and clean up (c)'s.
	* */glue/*.c : add lgpl license blurb and clean up (c)'s.
	file adds without license from now on are punishable by wedgie.

svn path=/trunk/gtk-sharp/; revision=30401
2004-06-25 18:42:19 +00:00
Daniel Kornhauser Eisenberg
737717e5a5 2003-10-27 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* glib/ListBase.cs : Added Indexer to allow [] based adressing
        * glib/List.cs : Added DllImport for Indexer
        * glib/SList.cs : Added DllImport for Indexer

svn path=/trunk/gtk-sharp/; revision=19420
2003-10-27 04:58:42 +00:00
Mike Kestner
9eeca84abe 2003-10-07 Mike Kestner <mkestner@ximian.com>
* glib/ListBase.cs : assume ref_owned=false for GObject lists.
	[Fixes #49145]

svn path=/trunk/gtk-sharp/; revision=18710
2003-10-07 18:08:32 +00:00
Gonzalo Paniagua Javier
0996f5f7fd 2003-08-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* gconf/GConf/Value.cs: implemented support for lists.

	* glib/ListBase.cs: implemented the IDisposable stuff and created a
	new method, FreeList, to free the list when needed.

	* glade/HandlerNotFoundException.cs: make it derive from
	SystemException. Don't override Message, the message is created in the
	.ctor.

svn path=/trunk/gtk-sharp/; revision=17646
2003-08-26 21:26:30 +00:00
John Luke
350fd53fa7 2003-08-19 John Luke <jluke@cfl.rr.com>
* glib/ListBase.cs:  Add convenience .Append (string) method

svn path=/trunk/gtk-sharp/; revision=17416
2003-08-19 21:07:24 +00:00
Mike Kestner
23464e6514 2003-07-23 Mike Kestner <mkestner@ximian.com>
[Equal credit to Ettore Perazzoli <ettore@ximian.com> for fixing
	all the bugs in the initial patch]
	* */*.custom : fix incorrect usage of new Object (IntPtr) where
	Glib.Object.GetObject should've been used.  add ref_owned param
	to GetObject calls.
	* generator/CallbackGen.cs : setup ref_owned in bodies
	* generator/ClassBase.cs : add ref_owned to GetObject FromNative call
	* generator/Method.cs : setup ref_owned in bodies
	* generator/Property.cs : setup ref_owned in bodies
	* generator/SignalHandler.cs : pass ref_owned to GetObject
	* generator/StructBase.cs : setup ref_owned in bodies
	* glib/Object.cs : kill Ref/Unref methods.  Don't want it to be
	easy for users to screw with ref counts, or make it look like they
	should need to.
	(GetObject): add ref_owned param and ref/unref to remain at 1
	* glib/Value.cs : pass ref_owned to GetObject

svn path=/trunk/gtk-sharp/; revision=16581
2003-07-23 17:19:21 +00:00
Mike Kestner
95fc33f785 2003-02-24 Mike Kestner <mkestner@speakeasy.net>
* generator/ObjectGen.cs : gen GLib.Value ctor, not uint
	* glib/Object.cs : use GLib.Type in RegisterGType and
	  make the g_object_new ctor use GLib.Type.
	* glib/Type.cs : new thin wrapper for GValue type
	* glib/*.cs : s/Type/System.Type

svn path=/trunk/gtk-sharp/; revision=11920
2003-02-24 06:39:30 +00:00
Johannes Roith
01f0577b8c remove console printings
svn path=/trunk/gtk-sharp/; revision=10364
2003-01-10 22:23:19 +00:00
Martin Baulig
604034053a 2002-10-11 Martin Baulig <martin@gnome.org>
* glib/ListBase.cs (ListBase.Append): New public method.
	(ListBase.Prepend): New public method.

svn path=/trunk/gtk-sharp/; revision=8168
2002-10-11 15:43:52 +00:00
Gonzalo Paniagua Javier
31fe10076e 2002-09-01 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
* glib/ListBase.cs: fixed compilation (the base class must be at least
	as accesible as the derived ones).

svn path=/trunk/gtk-sharp/; revision=7169
2002-09-01 10:40:24 +00:00
Rachel Hestilow
c8d090f62f 2002-08-31 Rachel Hestilow <hestilow@ximian.com>
Proper GList, GSList support. Read-only for now.

	* glue/list.c: Added.
	* glue/Makefile.am: Add list.c
	* glue/type.c: Add function gtksharp_is_object.

	* glib/ListBase.cs, List.cs: Added.
	* glib/SList.cs: Inherit from ListBase.
	* glib/Object.cs: Add static method "IsObject".

	* generator/Method.cs: Pass on element_type to constructor
	if specified.
	* generator/SymbolTable.cs: Move GList to manual types.

	* sample/GladeViewer.cs: Remove list hacks.

	* sources/Gnome.metadata: Specify element types for
	CanvasPathDef.Split and IconList.GetSelection. Rename
	CanvasPathDef *to methods to properly capitalized *To.
	* sources/Gtk.metadata: Hide Widget.ListAccelClosures until
	GClosure is handled properly.
	* sources/Pango.metadata: Added.

	* sample/test/TestToolbar.cs: Compile with recent delegate changes.

svn path=/trunk/gtk-sharp/; revision=7166
2002-09-01 04:46:38 +00:00