Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - jace10

Pages: [1]
General / Help with game crashing on startup when run with an installer
« on: August 30, 2023, 07:25:52 am »
I am wondering if anyone here is familiar with issues when trying to make your game playable by others/distribute it.

I have my Debug and Release configurations both targeting x64, and made sure I am using 32 bit libraries for everything. The game works when I run it from visual studio in both Debug and Release configurations. I created a Setup Installer project, following https://learn.microsoft.com/en-us/cpp/ide/walkthrough-deploying-your-program-cpp?view=msvc-170. This Setup also builds without any errors or warnings.

However both on my PC and on any other I've tested on, when I install the program using the .msi generated by the Setup Installer project (which also installs successfully), when I go to run the game the window comes up white for a second and then goes away on its own in release mode. In Debug mode it throws up a popup saying "Debug Error".

I assume something must be happening with the dependencies, but I don't see any log output or any kind of feedback on why the app crashed.

Does anyone have experience on how to debug something like this or what might be the issue?


Graphics / Issue with Font when multiple threads are introduced
« on: May 11, 2020, 12:42:27 am »

I am writing a program, everything was going very smoothly with SMFL until I started trying to add some threads. I ran into an issue that causes a slight 5 second delay, (initializing/filling large array), so I wanted to spin off a thread at startup to get it out of the way early. However once I introduce the thread, my program always gets a "Read Access Violation" when it tries to call getGlobalBounds on one of my sf::Text objects later on, full call stack looks like this:

    redBeard.exe!sf::Texture::update(const sf::Texture & texture, unsigned int x, unsigned int y) Line 478   C++
    redBeard.exe!sf::Texture::update(const sf::Texture & texture) Line 443   C++
    redBeard.exe!sf::Font::findGlyphRect(sf::Font::Page & page, unsigned int width, unsigned int height) Line 732   C++
    redBeard.exe!sf::Font::loadGlyph(unsigned int codePoint, unsigned int characterSize, bool bold, float outlineThickness) Line 613   C++
    redBeard.exe!sf::Font::getGlyph(unsigned int codePoint, unsigned int characterSize, bool bold, float outlineThickness) Line 363   C++
    redBeard.exe!sf::Text::ensureGeometryUpdate() Line 519   C++
    redBeard.exe!sf::Text::getLocalBounds() Line 362   C++
    redBeard.exe!sf::Text::getGlobalBounds() Line 369   C++
>   redBeard.exe!Button::displayText() Line 53   C++
    redBeard.exe!Button::addDrawables() Line 150   C++
    redBeard.exe!MainMenu::setup() Line 84   C++
    redBeard.exe!SceneManager::init() Line 83   C++
    redBeard.exe!SceneManager::SceneManager(MainMenu * mainMenu, BattleScene * battleScene, MapScene * mapScene) Line 12   C++
    redBeard.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 49   C++

To be clear, right now I am joining on the thread, I see the same behavior whether I join it or detach it. The crash is occuring from my main thread, after the loading thread has completed (I know this because of the join).

I thought that perhaps if the other thread was calling loadFromFile on a font, it might be messing it up, but I have verified through debugging that my helper thread is calling no Font functions.

Here is what the full function that is crashing looks like:

void Button::displayText()
  std::lock_guard<std::mutex> lck{ buttonSfMutex };
  if (StringDb::StringEnum::NUM_STRINGS != textIndex)
    std::string textContents = StringDb::getString(textIndex);
    *textLabel = sf::Text();
    font = sf::Font();
    if (true == active)
    sf::FloatRect textBounds = textLabel->getGlobalBounds();
    if (textBounds.width <= width && textBounds.height <= height)
      //center text within button
      textLabel->setPosition(x + ((width - textBounds.width) / 2), y + ((height - textBounds.height) / 4));
    } //else, dont bother being smart about where its goin
      textLabel->setPosition(x, y);

The font variable is declared like so in Button.h:

  sf::Font font;

If I comment out the thread from running, everything works fine, so I think it has to have something with that, but I don't understand what could be going wrong since the font is local to the button and is being loaded in this function.

I appreciate any ideas, please let me know if you need to see more code or explanation on how I am doing something upstream.

Pages: [1]