> >> We could set a hasErrorInsets bool in Buffer when we insert error
> >> insets, and reset it to false when removeautoinsets is called. Of
> >> course, this does not handle the case where people delete error
> >> insets by hand, but maybe is it better than nothing.
>
> Juergen> The flag can be updated on such an action, don't you think
> Juergen> so?
>
> To do that, we should have a counter of number of inseterror. But I
> think this is asking for trouble (there are so many ways to add/remove
> an inseterror).

A maybe-stupid question without looking at the code: are there exactly as many 
InsetError instances as there are error insets in the document? If so, one 
can just make it like this:

InsetError {
public:
        InsetError() {
                ...
                m_count ++;
        }
        ~InsetError() {
                ...
                m_count --;
        }
        static inline count() { return m_count; }

protected:
        static int m_count;
}

static int InsetError::count = 0;


Now, as there can be many documents open, probably the m_count thingo should 
be an associative array indexed by document object address. Then the hope is 
that InsetError somehow knows the reference to the document it is created in. 
Does that make any sense at all? I admit I'm lazy for untarring the code 
archive and digging in it :-(

Cheers, Kuba Ober

Reply via email to