-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Reproducible Seg Fault when turning on Heavy-Duty Flashlight #78580
Labels
(S1 - Need confirmation)
Report waiting on confirmation of reproducibility
Comments
TRScheel
added
the
(S1 - Need confirmation)
Report waiting on confirmation of reproducibility
label
Dec 15, 2024
Confirmed.
You need a flashlight without a battery to reproduce it. Plug it into the car (or a placed battery) and try to turn it on. It might be important. If you remove the string:
Then turning on the flashlight does not cause a crash. @TRScheel Alternative. Insert a battery into the flashlight, then it will turn on without error. |
hmm, the Cataclysm-DDA/data/json/items/tool_armor.json Line 3539 in 32e2b3c
work the same way (with charges_per_use) and it doesn't crash. If im not missing anything, everything should be the same. 0x5c0,360,682,c20 src/item.cpp:12,149 item::getlight_emit() const seems like lighting requires battery charges. |
TRScheel
added a commit
to TRScheel/Cataclysm-DDA
that referenced
this issue
Dec 17, 2024
There was a segfault occuring on https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L12277 when turning on a heavy-duty flashlight while it is simultaneously connected to a power source (ie. a vehicle) and does not have a battery. Added: - a short circuit check for ammo to address this issue in the future in case there are any other edge cases where this occurs. - a check for a linked power source so the light source uses the power source's linked power when determining the illumination value. Fixes CleverRaven#78580 Note: I used https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L14177 as a reference for the linked power check above. This means the two power checks are extremely similar and it makes me believe that it would be beneficial to have a function such as `has_link_power` that returns a boolean (true for has power, false otherwise). My only hesitation is that I do not know where else that sort of power check is done and what the complete scope of the checks against `charge_rate` / `charge_interval` are for.
TRScheel
added a commit
to TRScheel/Cataclysm-DDA
that referenced
this issue
Dec 18, 2024
There was a segfault occuring on https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L12277 when turning on a heavy-duty flashlight while it is simultaneously connected to a power source (ie. a vehicle) and does not have a battery. Added: - a short circuit check for ammo to address this issue in the future in case there are any other edge cases where this occurs. - a check for a linked power source so the light source uses the power source's linked power when determining the illumination value. Fixes CleverRaven#78580 Note: I used https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L14177 as a reference for the linked power check above. This means the two power checks are extremely similar and it makes me believe that it would be beneficial to have a function such as `has_link_power` that returns a boolean (true for has power, false otherwise). My only hesitation is that I do not know where else that sort of power check is done and what the complete scope of the checks against `charge_rate` / `charge_interval` are for.
TRScheel
added a commit
to TRScheel/Cataclysm-DDA
that referenced
this issue
Dec 18, 2024
There was a segfault occuring on https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L12277 when turning on a heavy-duty flashlight while it is simultaneously connected to a power source (ie. a vehicle) and does not have a battery. Added: - a short circuit check for ammo to address this issue in the future in case there are any other edge cases where this occurs. - a check for a linked power source so the light source uses the power source's linked power when determining the illumination value. Fixes CleverRaven#78580 Note: I used https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L14177 as a reference for the linked power check above. This means the two power checks are extremely similar and it makes me believe that it would be beneficial to have a function such as `has_link_power` that returns a boolean (true for has power, false otherwise). My only hesitation is that I do not know where else that sort of power check is done and what the complete scope of the checks against `charge_rate` / `charge_interval` are for.
TRScheel
added a commit
to TRScheel/Cataclysm-DDA
that referenced
this issue
Dec 18, 2024
There was a segfault occuring on https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L12277 when turning on a heavy-duty flashlight while it is simultaneously connected to a power source (ie. a vehicle) and does not have a battery. Added: - a short circuit check for ammo to address this issue in the future in case there are any other edge cases where this occurs. - a check for a linked power source so the light source uses the power source's linked power when determining the illumination value. Fixes CleverRaven#78580 Note: I used https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L14177 as a reference for the linked power check above. This means the two power checks are extremely similar and it makes me believe that it would be beneficial to have a function such as `has_link_power` that returns a boolean (true for has power, false otherwise). My only hesitation is that I do not know where else that sort of power check is done and what the complete scope of the checks against `charge_rate` / `charge_interval` are for.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I attached the flashlight to the car and turned it on. Immediately caused a seg fault. It is reproducible.
Attach save file
Twain Harte-trimmed.tar.gz
Steps to reproduce
a
to use an itemExpected behavior
It shouldn't seg fault
Screenshots
Versions and configuration
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
Portal Storms Ignore NPCs [personal_portal_storms],
Slowdown Fungal Growth [no_fungal_growth],
Magiclysm [magiclysm],
Mythical Martial Arts [MMA],
Translate Complex Dialogue [translate_dialogue]
]
Additional context
config.zip
The text was updated successfully, but these errors were encountered: