FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.74k stars 404 forks source link

Game crashes when entering value into component in sub editor #9512

Closed Working-Joe closed 2 years ago

Working-Joe commented 2 years ago

Disclaimers

What happened?

Ocassionally, when entering a value into a component, the game crashes. It seems to happen when multiple components are selected, but it might have happened with just one too. The expected behaviour here is that if you enter a value into a field that is present in all the components, it gets set for all selected components.

Reproduction steps

I haven't found a consistent way to reproduce this, it happened with multiple components. Crash report below.

Bug prevalence

Happens regularly

Version

Other

-

V18.13.0

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

Barotrauma Client crash report (generated on 03/07/2022 01:51:21)

Barotrauma seems to have crashed. Sorry for the inconvenience! 

0DF4E9EAD3E584D8D2F6110DAA966284

Game version 0.18.13.0 (UnstableWindows, branch release, revision ec98e1c347)
Graphics mode: 1920x1080 (Fullscreen)
VSync ON
Language: English
Selected content packages: Vanilla, Testing space, Typhon2scam, Barotronics - Minigames, Barotronics - template, Barotronics - RNG, Barotronics - Serveillance, anti-flood duct, duct logic, Barotronics - Mapper, Animated Clown Turret, Barotronics - Sonar turret, Crescent Christmas pre-release, White label, Barotronics - Docking Rail, Unnamed, Unnamed, Barotronics - Train Shuttle, RGBexpert, RGBetter, RGB (but small), Greatly improved RGB assemblies, colour matching, rotating searchlights, Coalition Husks, DeformationTestCharacter, DP dry dock, DP dry dock shuttle, Coil balancing
Level seed: no level loaded
Loaded submarine: Coil balancing (B54CF911805BDE6B01972265DA2471C8)
Selected screen: Barotrauma.SubEditorScreen
SteamManager initialized

System info:
    Operating system: Microsoft Windows NT 10.0.19042.0 64 bit
    GPU name: NVIDIA GeForce GTX 1070
    Display mode: {Width:1920 Height:1080 Format:Color AspectRatio:1.7777778}
    GPU status: Normal

Exception: Type provided must be an Enum. (Parameter 'enumType') (System.ArgumentException)
Target site: System.RuntimeType ValidateRuntimeType(System.Type)
Stack trace: 
   at System.Enum.ValidateRuntimeType(Type enumType)
   at System.Enum.TryParse(Type enumType, String value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at Barotrauma.SerializableEntityEditor.MultiSetProperties(SerializableProperty property, Object parentObject, Object value) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 1446
   at Barotrauma.SerializableEntityEditor.SetPropertyValue(SerializableProperty property, Object entity, Object value) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 1350
   at Barotrauma.SerializableEntityEditor.<>c__DisplayClass29_0.<CreateStringField>g__OnApply|3(GUITextBox textBox) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 706
   at Barotrauma.SerializableEntityEditor.<>c__DisplayClass29_0.<CreateStringField>b__1(GUITextBox textBox, Keys keys) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 690
   at Barotrauma.GUITextBox.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GUI\GUITextBox.cs:line 477
   at Barotrauma.GUI.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GUI\GUI.cs:line 1229
   at Barotrauma.GameMain.Update(GameTime gameTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GameMain.cs:line 898
   at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 656
   at Microsoft.Xna.Framework.Game.Tick() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 504
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\SDL\SDLGamePlatform.cs:line 94
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 398
   at Microsoft.Xna.Framework.Game.Run() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 368
   at Barotrauma.Program.Main(String[] args) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Program.cs:line 59

Last debug messages:
[03/07/2022 01:44:16] Attempting to open ALC device "OpenAL Soft on Luidsprekers (Realtek High Definition Audio)"
[03/07/2022 01:44:14] Logged in as Working Joe (SteamID STEAM_1:0:167499710)
Regalis11 commented 2 years ago

Duplicate of https://github.com/Regalis11/Barotrauma/issues/9401

Working-Joe commented 2 years ago

Just to make sure, this was in v18.13.0, which is interesting as #9401 mentions the problem being fixed in that version. Should that ticket then be reopened?

Might be that the fix from that ticket affected the behaviour here. The crash is related to enums while I had this crash with RegEx components which don't use enums.

Regalis11 commented 2 years ago

You're right (should've taken a closer look at this before closing!).

This is a somewhat different, but related issue that was caused by one of the fixes implemented for #9401 (https://github.com/Regalis11/Barotrauma-development/commit/62f84506446b74e7b4d8234583f00e953d86ca38). Should now be fixed properly in https://github.com/Regalis11/Barotrauma-development/commit/6b71782a30a11a63291d62eee5d52df2371e8ad9

Working-Joe commented 2 years ago

Some additional details I'd have to test: If you're editing a field in one component, then select another (not ctrl-select) without pressing enter, the game also crashes

NilanthAnimosus commented 2 years ago

Tested against bugfixes commit https://github.com/Regalis11/Barotrauma-development/commit/6b71782a30a11a63291d62eee5d52df2371e8ad9

with the first fix I had tested a number of components fields, but guess I somehow missed strings of all things.

With the new fix, I am unable to cause it to crash single or multiple editing of regex, signal check, relay, regex, terminal, motiondetector and status monitors. Though most components are just strings, numbers, toggles and motion detectors are all I know with an enum property type, It seems to work fine for all value types I could think of.

judging by the fixed code changes the crash was caused by attempting to parse enum's on string property types that were not actually enum values. I don't see the fix causing problems anywhere else.

I'm also not able to make the game crash by editing a field, then changing to another map entity in the sub editor (component or otherwise) without hitting enter while editing a field (string or numeric), but the problem likely would have caused any string value changes to crash.

The commit fixing this issue is not part of unstable 0.18.14.0 as a note.

Tsunder commented 2 years ago

I'm getting this error, in 0.18.15,

"frequentl" even while editing values of labels/wiring components (haven't done much else yet though). like three times < 30 minutes

my crashes are after I try to "leave" the edit fields, by pressing Enter or by clicking elsewhere, I think. Wasn't recording so don't remember exactly.

 Barotrauma Client crash report (generated on 2022-07-16 6:03:37 PM)

Barotrauma seems to have crashed. Sorry for the inconvenience! 

A3E1BD9914304826B1774DE813786E1D

Game version 0.18.15.0 (ReleaseWindows, branch release, revision a7b22109e9)
Graphics mode: 2560x1440 (BorderlessWindowed)
VSync OFF
Language: English
Selected content packages: Vanilla, Rally, Rally, Mayari, Glitterbug (S), Glitterbug (S), tripoli, Tripoli (PVP), Mooncrusher, Mooncrusher, CODE Barracuda V1.6, Among Us - Susmarine, K-04 Goliath, Dig Bick, sub finder circuit for pvp, Dig Bick [pvp], Susmarine [pvp], K-04 Goliath [pvp], assembly stuff, astraltor's campaign sub, astraltor's sub building item assembly pack, Reprieve, Reprieve-Class Hospital Ship (Goph Original Ship), button light rotation thing, button light rotation thing1, Spinny things assembly pack
Level seed: no level loaded
Loaded submarine: button light rotation thing (E354AA31AC12BED9B210092C417BA35D)
Selected screen: Barotrauma.SubEditorScreen
SteamManager initialized

System info:
    Operating system: Microsoft Windows NT 10.0.19043.0 64 bit
    GPU name: NVIDIA GeForce GTX 1050 Ti
    Display mode: {Width:2560 Height:1440 Format:Color AspectRatio:1.7777778}
    GPU status: Normal

Exception: Type provided must be an Enum. (Parameter 'enumType') (System.ArgumentException)
Target site: System.RuntimeType ValidateRuntimeType(System.Type)
Stack trace: 
   at System.Enum.ValidateRuntimeType(Type enumType)
   at System.Enum.TryParse(Type enumType, String value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at Barotrauma.SerializableEntityEditor.MultiSetProperties(SerializableProperty property, Object parentObject, Object value) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 1451
   at Barotrauma.SerializableEntityEditor.SetPropertyValue(SerializableProperty property, Object entity, Object value) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 1391
   at Barotrauma.SerializableEntityEditor.<>c__DisplayClass29_0.<CreateStringField>g__OnApply|3(GUITextBox textBox) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 707
   at Barotrauma.SerializableEntityEditor.<>c__DisplayClass29_0.<CreateStringField>b__1(GUITextBox textBox, Keys keys) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 691
   at Barotrauma.GUITextBox.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GUI\GUITextBox.cs:line 477
   at Barotrauma.GUI.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GUI\GUI.cs:line 1229
   at Barotrauma.GameMain.Update(GameTime gameTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GameMain.cs:line 898
   at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 656
   at Microsoft.Xna.Framework.Game.Tick() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 504
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\SDL\SDLGamePlatform.cs:line 94
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 398
   at Microsoft.Xna.Framework.Game.Run() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 368
   at Barotrauma.Program.Main(String[] args) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Program.cs:line 59

Last debug messages:
[2022-07-16 5:50:00 PM] Attempting to open ALC device "OpenAL Soft on Speakers (Realtek(R) Audio)"
[2022-07-16 5:49:58 PM] Logged in as Lightning (SteamID STEAM_1:0:41823064)
Regalis11 commented 2 years ago

@Tsunder the fix is not included in v0.18.15.0

FlareFlo commented 2 years ago

Using a text display this too happened



Barotrauma seems to have crashed. Sorry for the inconvenience! 

A3E1BD9914304826B1774DE813786E1D

Game version 0.18.15.0 (ReleaseWindows, branch release, revision a7b22109e9)
Graphics mode: 3840x2160 (BorderlessWindowed)
VSync OFF
Language: English
Selected content packages: Vanilla, Meaningful Upgrades, Meaningful CPR, Lua For Barotrauma, Improved XP Rates, Amogus Companion, CsForBarotrauma, BetterHealthUI, Dont Open Debug Console On Errors, the, TrueAutoDoor, boat, diving_set, pato, pato1, issue_test, WaterDect, AutoDuct
Level seed: no level loaded
Loaded submarine: pato1 (A218A49F6E4BE19FCC1EFBE6FDC2C35F)
Selected screen: Barotrauma.SubEditorScreen
SteamManager initialized

System info:
    Operating system: Microsoft Windows NT 10.0.19042.0 64 bit
    GPU name: NVIDIA GeForce RTX 3060 Ti
    Display mode: {Width:3840 Height:2160 Format:Color AspectRatio:1.7777778}
    GPU status: Normal

Exception: Type provided must be an Enum. (Parameter 'enumType') (System.ArgumentException)
Target site: System.RuntimeType ValidateRuntimeType(System.Type)
Stack trace: 
   at System.Enum.ValidateRuntimeType(Type enumType)
   at System.Enum.TryParse(Type enumType, String value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at Barotrauma.SerializableEntityEditor.MultiSetProperties(SerializableProperty property, Object parentObject, Object value) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 1451
   at Barotrauma.SerializableEntityEditor.SetPropertyValue(SerializableProperty property, Object entity, Object value) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 1351
   at Barotrauma.SerializableEntityEditor.<>c__DisplayClass29_0.<CreateStringField>g__OnApply|3(GUITextBox textBox) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 707
   at Barotrauma.SerializableEntityEditor.<>c__DisplayClass29_0.<CreateStringField>b__1(GUITextBox textBox, Keys keys) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Serialization\SerializableEntityEditor.cs:line 691
   at Barotrauma.GUITextBox.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GUI\GUITextBox.cs:line 477
   at Barotrauma.GUI.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GUI\GUI.cs:line 1229
   at Barotrauma.GameMain.Update(GameTime gameTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GameMain.cs:line 898
   at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 656
   at Microsoft.Xna.Framework.Game.Tick() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 504
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\SDL\SDLGamePlatform.cs:line 94
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 398
   at Microsoft.Xna.Framework.Game.Run() in <DEV>\Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 368
   at Barotrauma.Program.Main(String[] args) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Program.cs:line 59

Last debug messages:
[17/07/2022 17:02:37] Attempting to open ALC device "OpenAL Soft on Kopfhörer (Lagoon ANC  Stereo)"
[17/07/2022 17:02:36] Logged in as FlareFlo (SteamID ****)```
Kefpull commented 2 years ago

Reproduction steps

I haven't found a consistent way to reproduce this, it happened with multiple components. Crash report below.

To reproduce (100% of times):

1: Launch game 2: press any key to continue 3: Customize > SUBMARINE EDITOR 4: go to entity menu 5: select "Electrical" tab 6: scroll down to "Text Display" and left click to select 7: paste the entity 2-3 times

DO NOT SELECT ANY OF THE COMPONENTS

8: without selecting any of the components, right click to exit the paste tool

9: select the first component

10: enter in a value into " ITEMLABEL > Text " box. DO NOT HIT "Enter" KEY, OR CLICK OFF COMPONENT

11: While the cursor (insertion point) is still active on component 1, directly select a freshly-pasted (never before selected) component

12: game crashes

tested on both of my pcs, no mods

works on both steam and torrent versions

video: https://www.youtube.com/watch?v=h66yAqUfAMk

14 different crash logs: https://drive.google.com/drive/folders/1z4GuI-Htd1E8e1CYMyYJu16Pf7W2a8aQ

NilanthAnimosus commented 2 years ago

Tested on 0.19.0.0

There are no crashes I can immediately find anymore (I've tried motion detectors enum value, boolean, integeter/float values such as quality and power usage, tried multi editing text labels for the "Text display" and regular labels, and regex components expression field) as well as different methods (drag, ctrl click, shift right click and "select matching items" all seemed ok to me)

I have however encountered one piece of strange behavour while testing this, in replicating kefpull's crash If you change the text in one component, don't hit enter and click a second component - both will strangely have their values changed. the options visible for the newly selected component will show an empty field / whatever its last value was, clicking off and back on shows it indeed has the new value (So this is set after the UI has updated too)?

Specifically this is:

  1. Creating two or more of an object sharing properties (such as two text displays)
  2. change the value in one without hitting enter or clicking off the UI field for it
  3. now click another identical/similar enough component, it will immediately update in world if its a text display but the UI will show the field as it was before (Like empty or old text).
  4. re-selecting the item to close and update the UI shows the change really took effect.
Regalis11 commented 2 years ago

Fixed in https://github.com/Regalis11/Barotrauma-development/commit/8ed34922dddbc99d04f299ce64d36c852b77bd60

juanjp600 commented 2 years ago

Fixed in v0.18.15.1