mirror of
https://github.com/SFML/SFML.git
synced 2024-11-29 06:41:05 +08:00
Fixed crash after disposing RenderWindow or RenderImage instances, in SFML.Net
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1637 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
5421f1c42f
commit
d69903765b
@ -374,6 +374,7 @@ namespace SFML
|
|||||||
internal Image(IntPtr thisPtr) :
|
internal Image(IntPtr thisPtr) :
|
||||||
base(thisPtr)
|
base(thisPtr)
|
||||||
{
|
{
|
||||||
|
myExternal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -383,6 +384,8 @@ namespace SFML
|
|||||||
/// <param name="disposing">Is the GC disposing the object, or is it an explicit call ?</param>
|
/// <param name="disposing">Is the GC disposing the object, or is it an explicit call ?</param>
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
protected override void Destroy(bool disposing)
|
protected override void Destroy(bool disposing)
|
||||||
|
{
|
||||||
|
if (!myExternal)
|
||||||
{
|
{
|
||||||
if (!disposing)
|
if (!disposing)
|
||||||
Context.Global.SetActive(true);
|
Context.Global.SetActive(true);
|
||||||
@ -392,6 +395,9 @@ namespace SFML
|
|||||||
if (!disposing)
|
if (!disposing)
|
||||||
Context.Global.SetActive(false);
|
Context.Global.SetActive(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool myExternal = false;
|
||||||
|
|
||||||
#region Imports
|
#region Imports
|
||||||
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||||
|
@ -173,6 +173,7 @@ namespace SFML
|
|||||||
internal View(IntPtr thisPtr) :
|
internal View(IntPtr thisPtr) :
|
||||||
base(thisPtr)
|
base(thisPtr)
|
||||||
{
|
{
|
||||||
|
myExternal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -183,9 +184,11 @@ namespace SFML
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
protected override void Destroy(bool disposing)
|
protected override void Destroy(bool disposing)
|
||||||
{
|
{
|
||||||
|
if (!myExternal)
|
||||||
sfView_Destroy(This);
|
sfView_Destroy(This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool myExternal = false;
|
||||||
#region Imports
|
#region Imports
|
||||||
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||||
static extern IntPtr sfView_Create();
|
static extern IntPtr sfView_Create();
|
||||||
|
Loading…
Reference in New Issue
Block a user