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 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>
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.
* 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
* 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
* glib/Source.cs: rework proxy removal to avoid boxing profile.
* glib/Idle.cs: save src_id in proxy to facilitate removal.
* glib/Timeout.cs: save src_id in proxy to facilitate removal.
[Fixes#359561]
svn path=/trunk/gtk-sharp/; revision=96363
* glib/Idle.cs : add locking on the source_handlers.
* glib/Source.cs : add locking on the source_handlers.
* glib/Timeout.cs : add locking on the source_handlers.
svn path=/trunk/gtk-sharp/; revision=41290
* glib/Source.cs: Add new base class to hold the method to be
called, and the proxy handler we use to keep references to them
and avoid a collection.
Exposes a new variables that references all the active Timeouts
and Idle handlers to avoid collection/
* glib/Timeout.cs: Implement TimeoutProxy that acts as a filter to
remove the proxy when the timeout is removed.
Register a TimeoutProxy when we create a timeout.
* glib/Idle.cs: Implement IdleProxy that acts as a filter to
remove the proxy when the idle handler is removed.
Register an IdleProxy when we create a timeout.
svn path=/trunk/gtk-sharp/; revision=34094
* */*.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
* glib/Log.cs: Make LogLevelFlags CLS compliant.
* glib/SignalCallback.cs: Set the constructor protection level to
protected, since it can not be instantiate.d
* glib/Marshaller.cs: Do not allow instances of this class as it
only exposes static methods.
* glib/Source.cs, glib/FileUtils.cs, glib/Timeout.cs,
glib/Thread.cs, glib/Markup.cs, glib/TypeConverter.cs: Ditto.
svn path=/trunk/gtk-sharp/; revision=20573