Page 1 of 1

[0.18.12] Crash moving item-with-inventory: "this->handPosition != NO_ITEM_STACK_INDEX was not true"

Posted: Fri Mar 13, 2020 11:33 pm
by Honktown
Crash when moving an item-with-inventory from a second nested layer to inventory (instantly on dropping the selected item into character inventory). Steps to reproduce follow, but trying it repeatedly doesn't always seem to cause the crash.

Code: Select all

Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-fhxgyd\src\item\inventory.cpp (939): Inventory::releaseHand
c:\cygwin64\tmp\factorio-build-fhxgyd\src\gameactionhandler.cpp (1808): GameActionHandler::cursorTransfer
c:\cygwin64\tmp\factorio-build-fhxgyd\src\gameactionhandler.cpp (335): GameActionHandler::actionPerformed
c:\cygwin64\tmp\factorio-build-fhxgyd\src\input\inputhandler.cpp (61): InputHandler::flushActions
c:\cygwin64\tmp\factorio-build-fhxgyd\src\gameactionhandler.cpp (378): GameActionHandler::update
c:\cygwin64\tmp\factorio-build-fhxgyd\src\mainloop.cpp (1164): MainLoop::gameUpdateStep
c:\cygwin64\tmp\factorio-build-fhxgyd\src\mainloop.cpp (1037): MainLoop::gameUpdateLoop
c:\cygwin64\tmp\factorio-build-fhxgyd\src\util\workerthread.cpp (49): WorkerThread::loop
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (230): std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl RazerChromaController::*)(void),RazerChromaController *>,std::default_delete<std::tuple<void (__cdecl RazerChromaController::*)(void),RazerChromaController *> > > >::_Go
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (209): std::_Pad::_Call_func
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp (115): thread_start<unsigned int (__cdecl*)(void * __ptr64)>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007759652D)
000000007759652D (kernel32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00000000777CC541)
00000000777CC541 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
  51.093 Error Inventory.cpp:939: this->handPosition != NO_ITEM_STACK_INDEX was not true
Logger::writeStacktrace skipped.
  51.093 Error CrashHandler.cpp:190: Map tick at moment of crash: 833

Testing "item-with-inventory" and made these changes:

Code: Select all

data.raw["item-with-inventory"]["item-with-inventory"].inventory_size = 48
table.insert(data.raw["item-with-inventory"]["item-with-inventory"].flags, "not-stackable")
data.raw["item-with-inventory"]["item-with-inventory"].extends_inventory_by_default = true
Gave myself three of them, one-at-a-time with console:

Code: Select all

/c game.player.get_main_inventory().insert("item-with-inventory")
1. Opened character inventory, put into cursor an item-with inventory (the third), right clicked another (first), and placed the picked-up item-with-inventory inside.
2. Put into cursor the empty item-with-inventory in my character's inventory (second), entered the embedded item-with-inventory, and put the item-with-inventory inside. Did not open after placing. To be clear: item->item->item
3. Picked up the item with inventory I just placed, and put it back into character inventory.

I've been able to get the crash four or five times now, but as mentioned, not reliably.

log (minus a bunch of "found duplicate mod" messages)
factorio-current.log
(7.13 KiB) Downloaded 151 times
Freeplay save at beginning of game, before using any console commands
nesting_crash.zip
(1.09 MiB) Downloaded 143 times
mod form of changes (unknown if needed to cause crash)
nestingcrash_1.0.0.zip
(780 Bytes) Downloaded 150 times
dump:
factorio-dump-current.dmp
(667.62 KiB) Downloaded 138 times
screenshot after crash:
full screenshot

What I was expecting: to be able to expand my inventory if I had the item-with-inventory in it, and extends_inventory_by_default = true. Set "not-stackable" flag because I typically play modded games with different stack sizes and was planning ahead for potential problems.

Re: [0.18.12] Crash moving item-with-inventory: "this->handPosition != NO_ITEM_STACK_INDEX was not true"

Posted: Tue Mar 17, 2020 6:05 pm
by Rseding91
Thanks for the report. It's now fixed for the next release.