mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-22 19:15:34 +00:00
Fix loading of resources if jit inlines method (#328)
Added no inlining attribute for methods with Assembly.GetCallingAssembly() so caller assembly is correct if jit want to inline. See https://github.com/picoe/Eto/pull/2049.
This commit is contained in:
parent
0c5bd3f471
commit
e48e6e0380
|
@ -35,6 +35,7 @@
|
||||||
namespace Gdk {
|
namespace Gdk {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public partial class Pixbuf {
|
public partial class Pixbuf {
|
||||||
|
@ -94,14 +95,16 @@ namespace Gdk {
|
||||||
Raw = pl.PixbufHandle;
|
Raw = pl.PixbufHandle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public Pixbuf (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero)
|
public Pixbuf (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero)
|
||||||
{
|
{
|
||||||
using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource)) {
|
using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource)) {
|
||||||
Raw = pl.PixbufHandle;
|
Raw = pl.PixbufHandle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public Pixbuf (System.Reflection.Assembly assembly, string resource, int width, int height) : base (IntPtr.Zero)
|
public Pixbuf (System.Reflection.Assembly assembly, string resource, int width, int height) : base (IntPtr.Zero)
|
||||||
{
|
{
|
||||||
using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource, width, height)) {
|
using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource, width, height)) {
|
||||||
|
@ -123,6 +126,7 @@ namespace Gdk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
static public Pixbuf LoadFromResource (string resource)
|
static public Pixbuf LoadFromResource (string resource)
|
||||||
{
|
{
|
||||||
return new Pixbuf (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
return new Pixbuf (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
namespace Gdk {
|
namespace Gdk {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public partial class PixbufAnimation {
|
public partial class PixbufAnimation {
|
||||||
|
@ -46,6 +47,7 @@ namespace Gdk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public PixbufAnimation (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero)
|
public PixbufAnimation (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (assembly == null)
|
if (assembly == null)
|
||||||
|
@ -56,6 +58,7 @@ namespace Gdk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
static public PixbufAnimation LoadFromResource (string resource)
|
static public PixbufAnimation LoadFromResource (string resource)
|
||||||
{
|
{
|
||||||
return new PixbufAnimation (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
return new PixbufAnimation (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
namespace Gdk {
|
namespace Gdk {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public partial class PixbufLoader {
|
public partial class PixbufLoader {
|
||||||
|
@ -96,6 +97,7 @@ namespace Gdk {
|
||||||
InitFromStream(stream);
|
InitFromStream(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public PixbufLoader (System.Reflection.Assembly assembly, string resource) : this ()
|
public PixbufLoader (System.Reflection.Assembly assembly, string resource) : this ()
|
||||||
{
|
{
|
||||||
InitFromAssemblyResource(assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource);
|
InitFromAssemblyResource(assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource);
|
||||||
|
@ -116,7 +118,8 @@ namespace Gdk {
|
||||||
Close ();
|
Close ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public PixbufLoader (System.Reflection.Assembly assembly, string resource, int width, int height) : this ()
|
public PixbufLoader (System.Reflection.Assembly assembly, string resource, int width, int height) : this ()
|
||||||
{
|
{
|
||||||
SetSize(width, height);
|
SetSize(width, height);
|
||||||
|
@ -135,8 +138,7 @@ namespace Gdk {
|
||||||
} finally {
|
} finally {
|
||||||
Close ();
|
Close ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PixbufLoader (byte[] buffer, int width, int height) : this()
|
public PixbufLoader (byte[] buffer, int width, int height) : this()
|
||||||
{
|
{
|
||||||
|
@ -144,11 +146,10 @@ namespace Gdk {
|
||||||
InitFromBuffer(buffer);
|
InitFromBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
static public PixbufLoader LoadFromResource (string resource)
|
static public PixbufLoader LoadFromResource (string resource)
|
||||||
{
|
{
|
||||||
return new PixbufLoader (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
return new PixbufLoader (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace Gtk {
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
@ -174,16 +175,19 @@ namespace Gtk {
|
||||||
AddFromStream (s);
|
AddFromStream (s);
|
||||||
TranslationDomain = translation_domain;
|
TranslationDomain = translation_domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public Builder (string resource_name) : this (Assembly.GetCallingAssembly (), resource_name, null)
|
public Builder (string resource_name) : this (Assembly.GetCallingAssembly (), resource_name, null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public Builder (string resource_name, string translation_domain)
|
public Builder (string resource_name, string translation_domain)
|
||||||
: this (Assembly.GetCallingAssembly (), resource_name, translation_domain)
|
: this (Assembly.GetCallingAssembly (), resource_name, translation_domain)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public Builder (Assembly assembly, string resource_name, string translation_domain) : this ()
|
public Builder (Assembly assembly, string resource_name, string translation_domain) : this ()
|
||||||
{
|
{
|
||||||
if (GetType() != typeof (Builder))
|
if (GetType() != typeof (Builder))
|
||||||
|
|
|
@ -3,11 +3,14 @@ namespace Gtk
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
public partial class CssProvider
|
public partial class CssProvider
|
||||||
{
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public bool LoadFromResource(string resource) => LoadFromResource(Assembly.GetCallingAssembly(), resource);
|
public bool LoadFromResource(string resource) => LoadFromResource(Assembly.GetCallingAssembly(), resource);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public bool LoadFromResource(Assembly assembly, string resource)
|
public bool LoadFromResource(Assembly assembly, string resource)
|
||||||
{
|
{
|
||||||
if (assembly == null)
|
if (assembly == null)
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Gtk {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public partial class Image {
|
public partial class Image {
|
||||||
|
@ -83,6 +84,7 @@ namespace Gtk {
|
||||||
LoadFromStream (stream);
|
LoadFromStream (stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public Image (System.Reflection.Assembly assembly, string resource) : this ()
|
public Image (System.Reflection.Assembly assembly, string resource) : this ()
|
||||||
{
|
{
|
||||||
if (assembly == null)
|
if (assembly == null)
|
||||||
|
@ -95,6 +97,7 @@ namespace Gtk {
|
||||||
LoadFromStream (s);
|
LoadFromStream (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
static public Image LoadFromResource (string resource)
|
static public Image LoadFromResource (string resource)
|
||||||
{
|
{
|
||||||
return new Image (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
return new Image (System.Reflection.Assembly.GetCallingAssembly (), resource);
|
||||||
|
|
|
@ -21,10 +21,12 @@
|
||||||
namespace Gtk {
|
namespace Gtk {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public partial class UIManager {
|
public partial class UIManager {
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public uint AddUiFromResource (string resource)
|
public uint AddUiFromResource (string resource)
|
||||||
{
|
{
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
|
|
Loading…
Reference in a new issue