[Libreoffice] [PATCH] removing mpNotes field from ScBaseCell
Noel Grandin
noelgrandin at gmail.com
Sat Dec 17 13:01:06 PST 2011
Hi
Yeah, that is what I tried the first time.
But it turns out to be incredibly hard to keep the lifecycle of the
ScBaseCell objects and the lifecycle of the ScPostIt objects tied
together, because ScBaseCell and it's child classes get allocated and
deallocated in lots of different places, not just in ScTable.
-- Noel
On Sat, Dec 17, 2011 at 21:43, Markus Mohrhard
<markus.mohrhard at googlemail.com> wrote:
> Hello Noel,
>
>
>> So I've been working on this patch to move mpNotes from ScBaseCell to
>> ScTable, and I got it mostly working.
>> But I was struggling with leaks and getting the lifecycle of the notes
>> to exactly match the lifecycle of the ScBaseCell object.
>>
>
> I think that we should go another way. Firstly we should not use a
> static variable here. Please make the NotesMap a member variable of
> ScTable. I hope that this solves one part of your problem and then we
> should no longer need to make the notes directly available to the
> cells. Every information we need should already be available in
> ScTable and the idea behind this rework is not only to save a bit
> memory per cell but to prepare calc for ixion.
>
> Personally I think we should use another datastructure like
> std::map<Address2D, ScPostIt*> or bootst::ptr_map<Address2D, ScPostIt>
> but that is something we can figure out later. I think for now it is
> more important to move the container to ScTable and make it a member
> variable.
>
>> So then I had a weird idea - how about if I tied the lifecycles
>> together implicitly?
>> So I came up with this patch.
>>
>> It compiles, and passes a make check.
>>
>> I'll do a memcheck run on Monday when I can get access to my other
>> machine with tons of memory.
>
> Markus
More information about the LibreOffice
mailing list