Skip to content

Commit

Permalink
printing multiple times broken because SDL_FreeSurface doesnt make th…
Browse files Browse the repository at this point in the history
…e ptr nullptr
  • Loading branch information
GXTX committed Jan 10, 2024
1 parent d775682 commit fc5c347
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Includes/Printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool Printer::QueuePrintLine(std::vector<uint8_t>& data)

// Microsoft in their infinite wisdom defines min in windows.h, so we can't use std::min
constexpr auto maxOffset = 0x14;
uint8_t offset = (data[2] < maxOffset) ? data[2] : maxOffset;
uint8_t offset = data[2];

if (static_cast<BufferControl>(data[1]) == BufferControl::Clear)
m_printQueue.clear();
Expand Down
5 changes: 4 additions & 1 deletion Includes/Printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ class Printer
if (m_cardImage != nullptr) {
SaveCardImage(m_localName);
SDL_FreeSurface(m_cardImage);
m_cardImage = nullptr;
}
m_localName = "";
}

void Erase()
{
if (m_cardImage != nullptr)
if (m_cardImage != nullptr) {
SDL_FreeSurface(m_cardImage);
m_cardImage = nullptr;
}
}

bool RegisterFont(std::vector<uint8_t>& data);
Expand Down

0 comments on commit fc5c347

Please sign in to comment.