fix #H3039 - panic() when trying to drop destroyed items
From a bug report, dropping a lit (burning) potion of oil while levitating can produce an explosion which can destroy inventory. If in the process of dropping multiple items, the ones after the oil might be gone, resulting in use of stale pointers and possibly triggering an "extract_nobj: object lost" panic or even a crash. While testing my fix, I discovered that being killed by an exploding potion of oil could produce an "object_is_local" panic if bones are saved (and reproduced with unmodified 3.4.3).
This commit is contained in:
@@ -1710,6 +1710,9 @@ struct obj *obj, *otmp;
|
||||
* meat; prevent those contents from being hit.
|
||||
* retouch_equipment() - bypass flag is used to track which
|
||||
* items have been handled (bhito isn't involved).
|
||||
* menu_drop(), askchain() - inventory traversal where multiple
|
||||
* Drop can alter the invent chain while traversal
|
||||
* is in progress (bhito isn't involved).
|
||||
*
|
||||
* The bypass bit on all objects is reset each turn, whenever
|
||||
* context.bypasses is set.
|
||||
|
||||
Reference in New Issue
Block a user