Marked possible leaking functions, made crappy fix

This commit is contained in:
Aragas 2016-09-22 22:46:53 +03:00
parent 69ec7efbb1
commit cd77bba60e
4 changed files with 19 additions and 3 deletions

View File

@ -190,6 +190,7 @@
Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID) Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID)
If Not t Is Nothing Then If Not t Is Nothing Then
Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F) Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F)
'It will leak
t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y))) t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y)))
End If End If
End If End If
@ -252,6 +253,7 @@
Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID) Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID)
If Not t Is Nothing Then If Not t Is Nothing Then
Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F) Dim spriteSize As New Vector2(t.Width / 3.0F, t.Height / 4.0F)
'It will leak
t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y))) t3 = TextureManager.TextureRectangle(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y)))
End If End If
End If End If

View File

@ -385,7 +385,10 @@
c = Color.Gray c = Color.Gray
End If End If
Core.SpriteBatch.Draw(Route.getTexture(objectsTexture, isSelected), Route.getRectangle(mapOffset), c) ' Plz Fix It Aragaz Plz
Dim texture = Route.getTexture(objectsTexture, isSelected)
Core.SpriteBatch.Draw(texture, Route.getRectangle(mapOffset), c)
texture.Dispose()
Next Next
End If End If
@ -401,7 +404,10 @@
c = Color.Gray c = Color.Gray
End If End If
Core.SpriteBatch.Draw(City.getTexture(objectsTexture, isSelected), City.getRectangle(mapOffset), c) ' Plz Fix It Aragaz Plz
Dim texture = City.getTexture(objectsTexture, isSelected)
Core.SpriteBatch.Draw(texture, City.getRectangle(mapOffset), c)
texture.Dispose()
Next Next
End If End If
@ -417,7 +423,10 @@
c = Color.Gray c = Color.Gray
End If End If
Core.SpriteBatch.Draw(Place.getTexture(objectsTexture, isSelected), Place.getRectangle(mapOffset), c) ' Plz Fix It Aragaz Plz
Dim texture = Place.getTexture(objectsTexture, isSelected)
Core.SpriteBatch.Draw(texture, Place.getRectangle(mapOffset), c)
texture.Dispose()
Next Next
End If End If
@ -643,6 +652,7 @@
Return New Rectangle(CInt(Me.getPosition().X + offset.X), CInt(Me.getPosition().Y + offset.Y), sizeX, sizeY) Return New Rectangle(CInt(Me.getPosition().X + offset.X), CInt(Me.getPosition().Y + offset.Y), sizeX, sizeY)
End Function End Function
' It will leak
Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D
If Me.T Is Nothing Or isSelected = True Then If Me.T Is Nothing Or isSelected = True Then
Dim r As Rectangle Dim r As Rectangle
@ -794,6 +804,7 @@
Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY)) Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY))
End Function End Function
'It will leak
Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D
If Me.T Is Nothing Or isSelected = True Then If Me.T Is Nothing Or isSelected = True Then
Dim r As Rectangle Dim r As Rectangle
@ -943,6 +954,7 @@
Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY)) Return New Rectangle(CInt(Me.getPosition().X + PositionOffset.X + offset.X), CInt(Me.getPosition().Y + PositionOffset.Y + offset.Y), CInt(sizeX), CInt(sizeY))
End Function End Function
'It will leak
Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D Public Function getTexture(ByVal FullTexture As Texture2D, ByVal isSelected As Boolean) As Texture2D
If Me.T Is Nothing Or isSelected = True Then If Me.T Is Nothing Or isSelected = True Then
Dim r As Rectangle Dim r As Rectangle

View File

@ -367,6 +367,7 @@
CanMuteMusic = False CanMuteMusic = False
If ControllerHandler.ButtonPressed(Buttons.X) = True Then If ControllerHandler.ButtonPressed(Buttons.X) = True Then
'It will leak
Core.SetScreen(New InputScreen(Core.CurrentScreen, "Player", InputScreen.InputModes.Name, Me.CurrentText, 14, {TextureManager.TextureRectangle(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)), New Rectangle(0, 64, 32, 32))}.ToList(), AddressOf Me.ConfirmInput)) Core.SetScreen(New InputScreen(Core.CurrentScreen, "Player", InputScreen.InputModes.Name, Me.CurrentText, 14, {TextureManager.TextureRectangle(TextureManager.GetTexture("Textures\NPC\" & startSkins(SkinIndex)), New Rectangle(0, 64, 32, 32))}.ToList(), AddressOf Me.ConfirmInput))
Else Else
KeyBindings.GetNameInput(Me.CurrentText, 14) KeyBindings.GetNameInput(Me.CurrentText, 14)

View File

@ -1220,6 +1220,7 @@ Public Class TradeScreen
Core.SpriteBatch.DrawString(Font, Text, New Vector2(Position.X + Height + 10, Position.Y + textY), Color.White) Core.SpriteBatch.DrawString(Font, Text, New Vector2(Position.X + Height + 10, Position.Y + textY), Color.White)
End Sub End Sub
' It will leak.
Private Function GetItemTypeTexture(ByVal itemType As Items.ItemTypes) As Texture2D Private Function GetItemTypeTexture(ByVal itemType As Items.ItemTypes) As Texture2D
Dim i As Integer = 0 Dim i As Integer = 0
Select Case itemType Select Case itemType