-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some crashes 2025-01-13 #987
Fix some crashes 2025-01-13 #987
Conversation
…used in one place.
…sh::~Mesh() destructor
… those builds are failing anyway
Hi there! This does fix the crashing when loading a campaign #981 Pressing "m" in flight still causes a segfault. Also, it breaks ship info and purchasing repair and refuel's description, among other things, on a new campaign. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this on top of the other work I reviewed? seems like a lot of duplication.
…Position: ..." and "Target Position: ..." text string
…so fix a few more references to 8-sided armor
…11' into fix/index_out_of_bounds_2025-01-11
Just ran a little test now, and the python errors have changed somewhat. So, you are on the right track, I believe. |
LOL that's good to hear. In my very latest changes, I have succeeded in getting the .py files to load. Now it's just a matter of debugging the Python code! 😃 |
That's really good to hear! Ship View is now working for me too. For that, I had to make some changes to ship_view.py in the assets. I have a PR open for that here: vegastrike/Assets-Production#144 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this for every major function that I can think of, and everything works.
I did notice a few bugs from long ago, but not relevant to this PR.
I tested this in Windows. I can now launch a new campaign, which is good. When I flew to a nearby mining base and requested docking clearance, however, it crashed to the desktop. |
Do you have any logs for this? I have also had a crash, but thought it was due to my hitting the "pause" button by mistake. It's right next to the Delete/Insert key on this laptop. Unfortunately I did not grab a log, and it did not crash on the next couple of tries. |
The only log I can find (in my .vegastrike/logs directory) has nothing in it related to the crash. And worse than that, when I tried it again, it works fine without any crash. I hate intermittent bugs. |
@evertvorster that's awesome! @kheckwrecker I know, those are the worst. Unfortunately, the game has had intermittent crashes for quite a while. Probably not much we can do about that in this PR. Soon, though. Hopefully. |
I'm going to hold off on reviewing this until we merge #974. There are too many changes otherwise. |
Font font(font_array[0], font_array[1]); | ||
c->setFont(font); | ||
if (font_array.size() < 2) { | ||
VS_LOG(error, "controls_factory getControl(): font_array doesn't have enough elements"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why this condition is happening. We will probably want to investigate further. But for now, this keeps the game from crashing at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this raises a bigger philosophical question of how much crap are we willing to let the engine take from the assets?
For JSON files, the file obviously needs to be formatted correctly or parsing will fail. Most JSON files are crucial to the game, so may as well crash it with an error.
But this is inside content and for a specific control so it points to an error in how I converted fonts to controls. Best open an issue/bug for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed as vegastrike/Assets-Masters#56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a long review but much better. Thanks.
@BenjamenMeyer we may need to think about syncing our efforts so we don't write the same code twice. At least some of the code is stuff I've written but was waiting for the cmake stuff to get merged and splitting other stuff from it (like #969 ) so the actual review of the PR will be shorter and easier.
@@ -114,8 +116,8 @@ std::vector<std::string> getWeapFilterVec() { | |||
std::vector<std::string> weapfiltervec = getWeapFilterVec(); | |||
|
|||
bool upgradeNotAddedToCargo(std::string category) { | |||
for (unsigned int i = 0; i < weapfiltervec.size(); ++i) { | |||
if (weapfiltervec[i].find(category) == 0) { | |||
for (const auto & i : weapfiltervec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally don't have a problem with auto, but @BenjamenMeyer frowns upon them.
Therefore, where I can deduce the type, I'll use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenjamenMeyer has said previously that he's OK with auto for iterators.
@@ -527,7 +529,7 @@ void BaseComputer::constructControls(void) { | |||
return; | |||
} | |||
|
|||
if (m_displayModes.size() != 1 || m_displayModes[0] != NETWORK) { | |||
if (m_displayModes.size() != 1 || m_displayModes.at(0) != NETWORK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume these fail for some OS'es. I have the dangest errors in the CI, where my machine blissfully compiles and runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't fail to compile on any OS particularly. This is just to add bounds checking, to make sure we're not reading or writing outside the bounds of the collection.
@@ -3942,7 +3943,7 @@ string buildUpgradeDescription(Cargo &item) { | |||
const std::string key = item.GetName() + "__upgrades"; | |||
PyObject* args = PyTuple_Pack(1, PyUnicode_FromString(key.c_str())); | |||
const std::string text = GetString("get_upgrade_info", "upgrade_view", | |||
"python/base_computer/upgrade_view.py", args); | |||
"upgrade_view.py", args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on why you did this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You were specifying the subfolder ("python/base_computer"
) twice. Once here, and once in the Python path initialization code. That's part of why VS was failing to locate these Python scripts.
Now the subfolder is specified in only one place: initpaths()
. Which is more or less in keeping with the way existing code did things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that we could potentially have two utils.py somewhere with unexpected and hard to debug errors.
Font font(font_array[0], font_array[1]); | ||
c->setFont(font); | ||
if (font_array.size() < 2) { | ||
VS_LOG(error, "controls_factory getControl(): font_array doesn't have enough elements"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this raises a bigger philosophical question of how much crap are we willing to let the engine take from the assets?
For JSON files, the file obviously needs to be formatted correctly or parsing will fail. Most JSON files are crucial to the game, so may as well crash it with an error.
But this is inside content and for a specific control so it points to an error in how I converted fonts to controls. Best open an issue/bug for this.
@@ -524,7 +524,7 @@ float Damageable::RShieldData() const { | |||
void Damageable::ArmorData(float armor[8]) const { | |||
Damageable *damageable = const_cast<Damageable *>(this); | |||
DamageableLayer armor_layer = damageable->GetArmorLayer(); | |||
for (int i = 0; i < 8; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. You caught a bug of mine here. Did this segfault or fill the array with junk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I actually hit this section of code during my testing. If I had, though, I think a segfault would have been most likely. The destination array was too small to write 8 elements to.
(armor[1] + armor[3] + armor[5] | ||
+ armor[7]) / (float) (StartArmor[1] + StartArmor[3] + StartArmor[5] + StartArmor[7]), | ||
parent->GetHull() / (*maxhull), true, false); | ||
DrawHUDSprite(this, draw_damage_sprite ? parent->getHudImage() : nullptr, .6, x, y, w, h, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of the stuff for armor and 8 facets is stuff I'm waiting to submit. It would be interesting to compare and also a bit frustrating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. We would do well to communicate a bit better in real time about stuff we're working on. That isn't always feasible though, what with time zone differences and such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |
Code Changes:
Issues:
Purpose: