[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me...
From: |
Joris van der Hoeven |
Subject: |
Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me... |
Date: |
Tue, 5 Nov 2002 14:43:29 +0100 (MET) |
> I tested TeXmacs with the patch included and it seems to be stable now.
> Comments?
I also tested your patch now and, unfortunately,
I still get segfaults just after autosaving and typing a bit of text.
I also restudied the use of virtual destructors.
In fact, the current implementation is correct and best.
Indeed, you should not forget that a virtual destructor increases
the size of the data structure. Consequently, one should avoid
the use of it whenever possible.
> struct concrete_struct {
> int ref_count;
> inline concrete_struct (): ref_count (1) { DEBUG(concrete_count++); }
> - inline ~concrete_struct () { DEBUG(concrete_count--); }
> + inline virtual ~concrete_struct () { DEBUG(concrete_count--); }
> };
The classes concrete_struct and abstract_struct are really base classes
and *not* abstract classes: we never explicitly allocate a concrete_struct
or an abstract_struct. Moreover, the destructor does nothing when DEBUG
is inactive. We might just add "DEBUG(virtual)" to be extremely correct.
> +inline tree::~tree ()
> +{
> + if ((--rep->ref_count)==0) {
> + //destroy_tree_rep (rep);
> + delete rep;
> + rep = NULL;
> + }
> +}
Again, the function destroy_tree_rep explicitly does the "delete rep"
depending on the kind of tree (string or compound). Indeed, this type
can be determined as a function of "op", so destroy_tree_rep plays
the rĂ´le of a virtual destructor *without* the extra space overhead.
It may still be interesting though to add the line "rep = NULL"
to destroy_tree_rep.
- Re: [Texmacs-dev] GCC 3.2 status update, (continued)
- Re: [Texmacs-dev] GCC 3.2 status update, David Allouche, 2002/11/26
- Re: [Texmacs-dev] GCC 3.2 status update, Igor V. Kovalenko, 2002/11/26
- Re: [Texmacs-dev] GCC 3.2 status update, David Allouche, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, Joris van der Hoeven, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, David Allouche, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, Joris van der Hoeven, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, David Allouche, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, Joris van der Hoeven, 2002/11/27
Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me...,
Joris van der Hoeven <=
- Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Igor V. Kovalenko, 2002/11/05
- Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Joris van der Hoeven, 2002/11/05
- Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Igor V. Kovalenko, 2002/11/05
- Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Joris van der Hoeven, 2002/11/05
- Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Igor V. Kovalenko, 2002/11/05
- Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Joris van der Hoeven, 2002/11/06
- Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Igor V. Kovalenko, 2002/11/06
Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Joris van der Hoeven, 2002/11/05
Re: [Texmacs-dev] g++-3.2 segfaults -- linker -- virtual tree destructor, David Allouche, 2002/11/06
Re: [Texmacs-dev] g++-3.2 segfaults -- linker -- virtual tree destructor, Igor V. Kovalenko, 2002/11/06