View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0004807 | Spring engine | General | public | 2015-06-13 18:38 | 2015-06-14 00:55 | ||||
Reporter | abma | ||||||||
Assigned To | jK | ||||||||
Priority | normal | Severity | crash | Reproducibility | have not tried | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 98.0.1+git | ||||||||
Target Version | 99.0 | Fixed in Version | |||||||
Summary | 0004807: SIGSEV in SmokeTrailProjectile.cpp:203 | ||||||||
Description | (gdb) bt #0 0x0000039800000397 in ?? () #1 0x0000000000a6ab72 in CSmokeTrailProjectile::Draw (this=0x197e4000) at rts/Sim/Projectiles/Unsynced/SmokeTrailProjectile.cpp:203 #2 0x000000000074bff8 in CProjectileDrawer::Draw (this=0x119e8500, drawReflection=drawReflection@entry=false, drawRefraction=drawRefraction@entry=false) at rts/Rendering/ProjectileDrawer.cpp:652 0000003 0x000000000078373d in CWorldDrawer::Draw (this=<optimized out>) at rts/Rendering/WorldDrawer.cpp:213 0000004 0x00000000004d06f9 in CGame::Draw (this=0x1a1b200) at rts/Game/Game.cpp:1320 0000005 0x00000000007f2dac in SpringApp::Update (this=this@entry=0x7fffffffe110) at rts/System/SpringApp.cpp:943 #6 0x00000000007f9128 in SpringApp::Run (this=this@entry=0x7fffffffe110) at rts/System/SpringApp.cpp:975 #7 0x00000000007ce898 in Run (argc=argc@entry=1, argv=argv@entry=0x7fffffffe3f8) at rts/System/Main.cpp:48 #8 0x000000000046dd8a in main (argc=1, argv=0x7fffffffe3f8) at rts/System/Main.cpp:107 | ||||||||
Steps To Reproduce | /cheat /give all /give all 1 | ||||||||
Additional Information | Spring 98.0.1-777-gd1c9887 develop | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
Notes | |
jK (developer) 2015-06-14 00:55 |
Fix cf5f760ae167f59854e6abc9a9c41ba8c65edc08 committed to develop branch: fix 0004807: remove CObject::Detach() and move code back to dtor 00:03 [LCC]jK: OUCH 00:04 [LCC]jK: I am debugging the crash bug atm and I learned something 00:04 [LCC]jK: (first the bug is not by me) 00:05 [LCC]jK: second, virtual methods and virtual dtors are ... devil's work (same for ctor btw) 00:06 [LCC]jK: someone thought it would be smart to split of dtor into a Detach() function that can be called before the instance actually gets destructed 00:06 [LCC]jK: this had threading reasons (so the object can be removed from synced state, w/o making the pointers invalid) 00:07 [LCC]jK: now Detach() is a virtual method 00:07 [LCC]jK: and when Detach() wasn't called already the dtor of CObject will call it as last second option 00:08 [LCC]jK: (note again Detach does what the dtor normally does, so it has to be called!) 00:08 [LCC]jK: now the dtor of CObject is obviously virtual 00:09 [LCC]jK: and now, the point ;) 00:09 [LCC]jK: what does you think happens when you call the virtual Detach() from the virtual dtor of CObject ? ;) 00:10 [LCC]jK: you only call _one_ Detach 00:10 [LCC]jK: and it's ... CObject::Detach() 00:10 [LCC]jK: cause: 00:10 [LCC]jK: virtual dtors always work from top to down 00:11 [LCC]jK: so when CObject dtor is reached all other dtors are already called -> so you have just a CObject left all other inherited subclasses are removed/deleted 00:11 [LCC]jK: so when you do `dynamic_cast<SomeSubClass*>(this)` in a virtual dtor it will ALWAYS fail 00:12 [LCC]jK: so the rule is: you cannot call virtual methods in ctor/dtor, repo: spring changeset id: 5108 |
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2015-06-13 18:38 | abma | New Issue | |
2015-06-13 18:39 | abma | File Added: 20150205_215816_DeltaSiegeDry_98.0.1-364-g45c6f62 develop.sdf | |
2015-06-14 00:55 | jK | Changeset attached | => spring develop cf5f760a |
2015-06-14 00:55 | jK | Note Added: 0014584 | |
2015-06-14 00:55 | jK | Assigned To | => jK |
2015-06-14 00:55 | jK | Status | new => resolved |
2015-06-14 00:55 | jK | Resolution | open => fixed |