From d06bca9dba9041d568fb20b404322d86405c50b4 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 21 Oct 2015 19:23:42 +1100 Subject: [PATCH] Fix crashing of client on all platforms, fix new launcher crashing on linux. --- ClassicalSharp/TexturePack/TerrainAtlas1D.cs | 6 ++---- Launcher2/PlatformDrawer.cs | 2 +- OpenTK/Platform/X11/Functions.cs | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ClassicalSharp/TexturePack/TerrainAtlas1D.cs b/ClassicalSharp/TexturePack/TerrainAtlas1D.cs index 907bad208..bd370486f 100644 --- a/ClassicalSharp/TexturePack/TerrainAtlas1D.cs +++ b/ClassicalSharp/TexturePack/TerrainAtlas1D.cs @@ -44,7 +44,7 @@ namespace ClassicalSharp { elementsPerAtlas1D = Math.Min( elementsPerFullAtlas, totalElements ); int atlas1DHeight = Utils.NextPowerOf2( elementsPerAtlas1D * atlas2D.elementSize ); - Convert2DTo1D( atlas2D, atlasesCount, elementsPerAtlas1D ); + Convert2DTo1D( atlas2D, atlasesCount, atlas1DHeight ); elementsPerBitmap = atlas1DHeight / atlas2D.elementSize; invElementSize = 1f / elementsPerBitmap; } @@ -63,10 +63,8 @@ namespace ClassicalSharp { void Make1DTexture( int i, FastBitmap atlas, TerrainAtlas2D atlas2D, int atlas1DHeight, ref int index ) { int elemSize = atlas2D.elementSize; using( Bitmap atlas1d = new Bitmap( atlas2D.elementSize, atlas1DHeight ) ) { - using( FastBitmap dst = new FastBitmap( atlas1d, true ) ) { + using( FastBitmap dst = new FastBitmap( atlas1d, true ) ) { for( int index1D = 0; index1D < elementsPerAtlas1D; index1D++ ) { - - if( index >= 256 ) break; FastBitmap.MovePortion( (index & 0x0F) * elemSize, (index >> 4) * elemSize, 0, index1D * elemSize, atlas, dst, elemSize ); index++; diff --git a/Launcher2/PlatformDrawer.cs b/Launcher2/PlatformDrawer.cs index 92282d6bf..bc1b31787 100644 --- a/Launcher2/PlatformDrawer.cs +++ b/Launcher2/PlatformDrawer.cs @@ -55,7 +55,7 @@ namespace Launcher2 { fastBmp.Width, fastBmp.Height, 32, 0 ); API.XPutImage( API.DefaultDisplay, x11Info.WindowHandle, gc, image, 0, 0, 0, 0, fastBmp.Width, fastBmp.Height ); - API.XDestroyImage( image ); + API.XFree( image ); } } } diff --git a/OpenTK/Platform/X11/Functions.cs b/OpenTK/Platform/X11/Functions.cs index 8adc6629a..cd301af52 100644 --- a/OpenTK/Platform/X11/Functions.cs +++ b/OpenTK/Platform/X11/Functions.cs @@ -44,9 +44,6 @@ namespace OpenTK.Platform.X11 { public extern static Bool XCheckWindowEvent(Display display, Window w, EventMask event_mask, ref XEvent event_return); [DllImport("libX11"), SuppressUnmanagedCodeSecurity] public extern static Bool XCheckTypedWindowEvent(Display display, Window w, XEventName event_type, ref XEvent event_return); - - [DllImport("libX11"), SuppressUnmanagedCodeSecurity] - public extern static int XDestroyImage(IntPtr image); [DllImport("libX11"), SuppressUnmanagedCodeSecurity] public extern static int XDestroyWindow(IntPtr display, IntPtr window);