View Issue Details

IDProjectCategoryView StatusLast Update
0000905Spring engineGeneralpublic2008-04-30 13:11
Reporterzenzike Assigned Totvo  
PrioritynormalSeveritytrivialReproducibilityalways
Status resolvedResolutionfixed 
Summary0000905: [patch] WeaponDefHandler.h non-virtual destructor
DescriptionThe WeaponDef destructor is non-virtual.

Patch included.

(These are the first minor patches I'm suggesting - I've noticed that the patches I create show too much of the root (ie it includes /home/myname/projects/), is there any way to prevent this?)
Additional InformationIndex: spring/rts/Sim/Weapons/WeaponDefHandler.h
===================================================================
--- spring/rts/Sim/Weapons/WeaponDefHandler.h (revision 5796)
+++ spring/rts/Sim/Weapons/WeaponDefHandler.h (working copy)
@@ -33,7 +33,7 @@
 {
     CR_DECLARE(WeaponDef);
 
- ~WeaponDef();
+ virtual ~WeaponDef();
 
     std::string name;
     std::string type;
TagsNo tags attached.
Checked infolog.txt for Errors

Relationships

related to 0000904 resolvedtvo [patch] UnitDef.h non-virtual destructor 

Activities

tvo

2008-04-28 15:36

reporter   ~0002172

How do you create the patch? svn diff on linux?

zenzike

2008-04-28 15:38

reporter   ~0002174

Last edited: 2008-04-28 15:44

Yes, I used svn diff, and I'm developing in Linux.

tvo

2008-04-30 13:11

reporter   ~0002189

I probably solved it by using CR_DECLARE_STRUCT instead of CR_DECLARE in the WeaponDef. (CR_* is our "class registration system", ie. reflection for C++, and CR_DECLARE_STRUCT defines the GetClass method as non-virtual while CR_DECLARE defines it as virtual.)

This is better then making dtor virtual because the class really isn't supposed to have any virtual functions. (Since it's just a large collection of weapon properties.)

Please reopen if this didn't solve compiler warning.

Issue History

Date Modified Username Field Change
2008-04-28 12:40 zenzike New Issue
2008-04-28 15:35 tvo Summary WeaponDefHandler.h non-virtual destructor => [patch] WeaponDefHandler.h non-virtual destructor
2008-04-28 15:36 tvo Relationship added related to 0000904
2008-04-28 15:36 tvo Note Added: 0002172
2008-04-28 15:38 zenzike Note Added: 0002174
2008-04-28 15:44 zenzike Note Edited: 0002174
2008-04-30 13:10 tvo Status new => assigned
2008-04-30 13:10 tvo Assigned To => tvo
2008-04-30 13:11 tvo Status assigned => resolved
2008-04-30 13:11 tvo Resolution open => fixed
2008-04-30 13:11 tvo Note Added: 0002189