Skip to content

Commit

Permalink
Update graph.c
Browse files Browse the repository at this point in the history
  • Loading branch information
dmex committed Dec 28, 2024
1 parent fe100df commit e54d972
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions phlib/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,21 +682,25 @@ static VOID PhpDeleteBufferedContext(
_In_ PPHP_GRAPH_CONTEXT Context
)
{
if (Context->BufferedContext)
if (Context->BufferedContext && Context->BufferedOldBitmap)
{
// The original bitmap must be selected back into the context, otherwise the bitmap can't be
// deleted.
SelectBitmap(Context->BufferedContext, Context->BufferedOldBitmap);
Context->BufferedOldBitmap = NULL;
}

if (Context->BufferedBitmap)
{
DeleteBitmap(Context->BufferedBitmap);
Context->BufferedBitmap = NULL;
}

if (Context->BufferedContext)
{
DeleteDC(Context->BufferedContext);
Context->BufferedContext = NULL;

Context->BufferedBits = NULL;
}

Context->BufferedBits = NULL;
}

static VOID PhpCreateBufferedContext(
Expand Down Expand Up @@ -727,19 +731,25 @@ static VOID PhpDeleteFadeOutContext(
_In_ PPHP_GRAPH_CONTEXT Context
)
{
if (Context->FadeOutContext)
if (Context->FadeOutContext && Context->FadeOutOldBitmap)
{
SelectBitmap(Context->FadeOutContext, Context->FadeOutOldBitmap);
Context->FadeOutOldBitmap = NULL;
}

if (Context->FadeOutBitmap)
{
DeleteBitmap(Context->FadeOutBitmap);
Context->FadeOutBitmap = NULL;
}

if (Context->FadeOutContext)
{
DeleteDC(Context->FadeOutContext);
Context->FadeOutContext = NULL;

Context->FadeOutBits = NULL;
}

Context->FadeOutBits = NULL;
}

static VOID PhpCreateFadeOutContext(
Expand Down

0 comments on commit e54d972

Please # to comment.