Crash when using "entity-preview" gui element

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
GalactusX31
Inserter
Inserter
Posts: 28
Joined: Thu Jul 20, 2017 11:27 am
Contact:

Crash when using "entity-preview" gui element

Post by GalactusX31 »

I need to know how to use / implement this gui element for my mod; In the wiki and api page there is no information about the use of this, and every time I try to add it and use it, my game crashes and throws me off.

I have tried to find information about it, but I have not been able to find it anywhere, I would appreciate someone showing me how it can be done to have a preview of the selected entity, as does factorio.

Thanks

Image

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Use of "entity-preview" gui element

Post by Klonan »

GalactusX31 wrote:I need to know how to use / implement this gui element for my mod; In the wiki and api page there is no information about the use of this, and every time I try to add it and use it, my game crashes and throws me off.

I have tried to find information about it, but I have not been able to find it anywhere, I would appreciate someone showing me how it can be done to have a preview of the selected entity, as does factorio.

Thanks

Image
Seems to crash for me too:

Code: Select all

Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\factorio\libraries\stackwalker\stackwalker.cpp (907): StackWalker::ShowCallstack
c:\factorio\src\util\logger.cpp (367): Logger::writeStacktrace
c:\factorio\src\util\logger.cpp (469): Logger::logStacktrace
c:\factorio\src\util\crashhandler.cpp (155): CrashHandler::writeStackTrace
c:\factorio\src\util\crashhandler.cpp (485): CrashHandler::SignalHandler
d:\th\minkernel\crts\ucrt\src\appcrt\misc\exception_filter.cpp (219): _seh_filter_exe
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (299): `__scrt_common_main_seh'::`1'::filt$0
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF6ACAB9AE0)
00007FF6ACAB9AE0 (factorio-run): (filename not available): __C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF31774C7D)
00007FFF31774C7D (ntdll): (filename not available): _chkstk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF316ED1D8)
00007FFF316ED1D8 (ntdll): (filename not available): RtlWalkFrameChain
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF31773BAE)
00007FFF31773BAE (ntdll): (filename not available): KiUserExceptionDispatcher
c:\factorio\libraries\agui\src\agui\style.cpp (141): agui::Style::getNaturalWidth
c:\factorio\libraries\agui\src\agui\widget\widget.cpp (1243): agui::Widget::resizeToContents
c:\factorio\libraries\agui\src\agui\widget\widget.cpp (1259): agui::Widget::resizeToContentsRecursive
c:\factorio\libraries\agui\src\agui\widget\widget.cpp (1253): agui::Widget::resizeToContentsRecursive
c:\factorio\libraries\agui\src\agui\topcontainer.cpp (22): agui::TopContainer::processTriggersToResize
c:\factorio\src\graphics\guirenderer.cpp (50): GuiRenderer::prepare
c:\factorio\src\mainloop.cpp (799): MainLoop::prepare
c:\factorio\src\mainloop.cpp (530): MainLoop::mainLoopStep
c:\factorio\src\mainloop.cpp (332): MainLoop::run
c:\factorio\src\main.cpp (1108): wmain
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (283): __scrt_common_main_seh
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF2ED61FE4)
00007FFF2ED61FE4 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF3173EFC1)
00007FFF3173EFC1 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
  26.884 Error CrashHandler.cpp:156: Map tick at moment of crash: 650
  26.884 Error Util.cpp:67: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
  28.577 Creating crash dump.
  28.673 CrashDump success
moving to bug reports

Code: Select all

/c entity = game.player.selected game.player.gui.center.add{type = "entity-preview", entity = entity}

Rseding91
Factorio Staff
Factorio Staff
Posts: 13173
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Crash when using "entity-preview" gui element

Post by Rseding91 »

Thanks for the report. It's now fixed for the next version of 0.16.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Crash when using "entity-preview" gui element

Post by eradicator »

Odd. It worked fine when i tested it when it was first added.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Crash when using "entity-preview" gui element

Post by Klonan »

eradicator wrote:Odd. It worked fine when i tested it when it was first added.
If you set a style on it, i think it would work

User avatar
GalactusX31
Inserter
Inserter
Posts: 28
Joined: Thu Jul 20, 2017 11:27 am
Contact:

Re: Crash when using "entity-preview" gui element

Post by GalactusX31 »

I can confirm, that even if I put a style to that element, it keeps crashing the game

User avatar
GalactusX31
Inserter
Inserter
Posts: 28
Joined: Thu Jul 20, 2017 11:27 am
Contact:

Re: Crash when using "entity-preview" gui element

Post by GalactusX31 »

Nvm, problem solved, thanks

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Crash when using "entity-preview" gui element

Post by eradicator »

@0.16.26:

The example code supplied by Klonan that assigns the entity directly when creating the gui element doesn't work for me. It only creates an empty entity-preview. The only way i can get an entity to actually show up in the preview is by assigning the entity after creating the gui element. Would be nice if assignment on creation worked.

Code: Select all

/c
g = game.player.gui.center
g.clear()
entity = game.player.selected
ep = g.add{type = "entity-preview", entity = entity}
ep.entity = entity --[[created empty without this]]


Rseding91
Factorio Staff
Factorio Staff
Posts: 13173
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Crash when using "entity-preview" gui element

Post by Rseding91 »

eradicator wrote:@0.16.26:

The example code supplied by Klonan that assigns the entity directly when creating the gui element doesn't work for me. It only creates an empty entity-preview. The only way i can get an entity to actually show up in the preview is by assigning the entity after creating the gui element. Would be nice if assignment on creation worked.

Code: Select all

/c
g = game.player.gui.center
g.clear()
entity = game.player.selected
ep = g.add{type = "entity-preview", entity = entity}
ep.entity = entity --[[created empty without this]]

Assignment on creation isn't supported and never will be.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Crash when using "entity-preview" gui element

Post by eradicator »

Rseding91 wrote:Assignment on creation isn't supported and never will be.
Oh. Well. Then i was just confued by Klonans example code :P. Thanks for the hint.

Post Reply

Return to “Resolved Problems and Bugs”