Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Mono compilation error branch #299

Open
wants to merge 407 commits into
base: main
Choose a base branch
from

Conversation

plprevost
Copy link

The Gtk# test component will not compile with mono v6.12.0.107 because of an ambigus cast System.Range vs Gtk.Range in TestRange.cs file.

Therzok and others added 30 commits July 20, 2016 18:02
…passed by value

In the case of TreeStore.GetValue, the generated code would try to assign
iter to the value that was marshalled back from native.

This behaviour is incorrect, as the struct was passed by value, and
discarded, having no effect on the code-flow but useless overhead.

public void GetValue(Gtk.TreeIter, int column, ref GLib.Value value) {
	IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc (iter);
	IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
	gtk_tree_model_get_value(Handle, native_iter, column, native_value);
	// The line below is removed.
	native_iter = TreeIter.New (native_iter);
	Marshal.FreeHGlobal (native_iter);
	value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
	Marshal.FreeHGlobal (native_value);
}
[Generator] Don't try to reconstruct the value on a struct parameter …
This avoid an extra heap allocation for each object passed by ref so it can be transitioned directly into native memory. Native counterparts will handle data mutation, so managed will see it anyway.
Generator: ByRef generator now passes the value by ref
…not JITed on every Application.Invoke

If method is instance instead of static every time it's passed as delegate to unmanaged code runtime(mono) needs to JIT it
since "this" is part of JITed method, with this change JITing doesn't need to be performed anymore
This reduces LookupGType from 165ms to 30ms on a stresstest of emitting button enter events.
Also, modify the collection copy in lock to a assign so GC grabs it.
Convert Timeout/Idle.Handler method from instance to static, so it's …
This avoid double allocation on an inherited class' constructor. The
initial code would create an ArrayList, pack in the items (probably
doing more allocations, as the ArrayList was initially Capacity=0),
then ToArray() it to pass the results.

This makes one one allocation per constructor of derived class.
In the usual case, we'd have to iterate the list every time we query
the Count, so in the for loops, we have O(n^2) complexity, when it
should be queried in O(n).

Made the code use wrapper methods which finish the operation in O(n),
one iteration in native, one in managed+native.
This makes it so we don't have to use reflection for defined enums.
This way we don't go the slow path for Enums checking whether the property exists.
Also, switch to Dictionary instead of hashtable.
Therzok and others added 30 commits June 17, 2017 17:34
The parameters require only a value*, not a GValueArray
* [Gtk] Make Application.Invoke snappier.

Mirrors behaviour from TimeoutProxy. Split into two classes, the Invoke without args class is now smaller. Fast-path by not creating extra junk along the way. Performance is now comparable to GLib.Timeout.Add.

* [GLib] Add comments to DestroyNotify.NotifyHandler

* [GLib] Unleak Idle.NotifyHandler from public API.

* [GLib] Slapped some comments on Timeout.Add (uint, GCHandle)

* [Gtk] Add Application.Invoke (Action) and (Action<T>, T)

This allows to create non-capturing lambdas.

* Fixup in InvokeProxyWithArgs.
Finalization is supressed in constructor if not owned
Don't allocate a new delegate every time we queue a timeout on finalization
* [Atk] Fix property names.

Atk defines the properties via const strings, not literal strings, so the perl parser grabs the wrong id. https://github.com/GNOME/atk/blob/125dac528339267821dbbd6da9b19fe9949334e9/atk/atkobject.c#L259-L273

* Fixup!
* [Gen] Generate with static callback where applicable.

* [Gdk] Fix extra space which didn't match type.

* [Gen] Fix generator not validating imported data

This, for example, makes parameters available for imported callbacks.

Thus, Gtk.Object now implements Atk.Implementor

* [Gtk] Get rid of some hacks and properly implement quit/input add

* [Gtk] Modify custom TextBuffer delegate wrapper.

* [Gen] Set some callback gen members on validation

Avoids codegen of bloat

* [Gen] Improve codegen of callbacks.

* [Gen] Avoid generating invoker if not used.

* [Gen] Handle all user data cases

* [Gen] Avoid allocating wrapper class if not needed.

* [Gen] Some more static generation in async handlers

* [Gen] Fix callback marshal return so static can be used

* [Gen] Marshal Gdk.FilterFunc as static wrapper

* [Clipboard] Make some callbacks static.

* [Gen] Fix handlers to return a managed delegate for a native one

* [Gen] Manually gen callback returning pinvokes.

* [Gen] Use WeakReference instead of IntPtr to track delegates

* Add missing files

* Remove useless metadata

* Add comment explaining intentional leak

* Set callback_wrapper

* [About] use the right pinvoke

* [TreeModelFilter] Don't gchandle.Alloc(null)

* Review feedback
Current Debian packaging puts libtool in its own package (libtool-bin)
leaving only libtoolize in the main package. The mono build process
uses libtoolize not libtool, so during autogen check for libtoolize
not libtool.

Change-Id: I956430b2fb223642e5b5a0ede1e81e42f85e098f
* Replace strings with const strings

This centralized a large chunk of the hard coded strings. The idea is
to make it easier to convert from raw to gir. For example, RAW uses
"enum", but GIR uses "enumeration". Using the const string we can find
all places in the generator that references "enum" as well as update the
name in only one place.

* Make constants class internal

* Add Constants.cs to automake

* Fix typo in DisableDefaultConstructor

* Fix typo
* Move to a newer TargetFrameworkVersion, 4.7.1

* Remove ArrayList from CodeGenerator.cs

* Removed unneeded using statements

* Remove System.Collection from Ctor.cs

* Add .vs to .gitignore

* Remove System.Collection from EnumGen.cs

* Remove System.Collection from FieldBase.cs

* Remove System.Collection from GenerationInfo.cs

* Remove System.Collections from VirtualMethod.cs

* Remove System.Collection from ClassBase, InterfaceGen, and ObjectGen

* Remove System.Collection from ManagedCallString.cs

* Remove System.Collections from Method.cs

* Remove System.Collections from MethodBody.cs

* Remove System.Collections from ObjectField.cs

* Remove System.Collections from ObjectGen.cs

* Remove System.Collections from OpaqueGen.cs

* Remove System.Collections from Property.cs

* Remove System.Collections from VMSignature.cs

* Remove System.Collections from SymbolTable

* Remove System.Collections from Signal.cs

* Remove System.Collections from StructBase.cs

* Removed System.Collections from Statistics.cs

* Remove System.Collections from Signature.cs

* Removed System.Collections from Parser.cs

* Remove System.Collections from Parameters.cs

* Revert 4.7.1 target framework change

* Return null if the Dictionaries don't .ContainsKey

* [Gen] Fixup dictionary usage

* Fixup
* [GLib] Fix Log.Write() format string vulnerability via new glue

The third parameter of g_logv(), as used in GLib.Log.Write(), is
actually not a message (as advertised in the prototype) but a
format string.

The formatting done via String.Format() may leave format specifiers
like %d unescaped, which can then lead to a crash / SIGSEGV while
executing native code. Note that such format specifiers may get
injected via something that then is supposed to get logged via the
affected GLib.Log.Write().

As I'm told that marshalling to a variable arguments function is
not supported, a new glue function, glibsharp_log_msg(), gets
introduced (in a new glue file, glib/glue/log.c). Its only purpose is
to replace passing the message as format string (which is wrong)
with passing "%s" as format string with the message following as
argument which is used as plain (non-format) string.

* Simplify code by using cdecl pinvoke specifics
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.