linux ui: Fix exception when there are multiple Run methods

This commit is contained in:
Hylke Bons 2018-02-20 01:12:14 +00:00
parent 2232d22259
commit 92dbc7e241

View file

@ -72,8 +72,20 @@ namespace SparkleShare
public void Run (string [] args)
{
MethodInfo run_method = typeof (GLib.Application).GetMethod ("Run");
ParameterInfo [] run_parameters = run_method.GetParameters ();
MethodInfo [] methods = typeof (GLib.Application).GetMethods (BindingFlags.Instance | BindingFlags.Public);
ParameterInfo [] run_parameters = new ParameterInfo [0];
MethodInfo run_method = methods [0];
foreach (MethodInfo method in methods) {
if (method.Name == "Run") {
run_parameters = method.GetParameters ();
if (run_parameters.Length == 2) {
run_method = method;
break;
}
}
}
// Use the right Run method arguments depending on the installed GTK bindings
if (run_parameters [0].ParameterType == typeof (System.Int32) &&