Added a comment to some stuff which wasn't so clear (thanks to Andrew for clarifying this).
Now we free() the run_array allocated by "RunArray()" (as we're supposed to do), thus removing a leak. Changed some includes from <> to "" just for my personal pleasure. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9648 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,12 +5,13 @@
|
|||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
#include <Node.h>
|
#include <Node.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <CharacterSet.h>
|
#include <CharacterSet.h>
|
||||||
#include <CharacterSetRoster.h>
|
#include <CharacterSetRoster.h>
|
||||||
#include <UTF8.h>
|
#include <UTF8.h>
|
||||||
|
|
||||||
#include <StyledEditView.h>
|
#include "StyledEditView.h"
|
||||||
#include <Constants.h>
|
#include "Constants.h"
|
||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
@@ -112,6 +113,8 @@ StyledEditView::GetStyledText(BPositionIO * stream)
|
|||||||
}
|
}
|
||||||
if (fEncoding != 0) {
|
if (fEncoding != 0) {
|
||||||
int32 length = stream->Seek(0,SEEK_END);
|
int32 length = stream->Seek(0,SEEK_END);
|
||||||
|
|
||||||
|
// Here we save the run_array before it gets overwritten...
|
||||||
text_run_array * run_array = RunArray(0,length);
|
text_run_array * run_array = RunArray(0,length);
|
||||||
uint32 id = BCharacterSetRoster::GetCharacterSetByFontID(fEncoding)->GetConversionID();
|
uint32 id = BCharacterSetRoster::GetCharacterSetByFontID(fEncoding)->GetConversionID();
|
||||||
fSuppressChanges = true;
|
fSuppressChanges = true;
|
||||||
@@ -145,7 +148,10 @@ StyledEditView::GetStyledText(BPositionIO * stream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ... and here we restore it
|
||||||
SetRunArray(0,length,run_array);
|
SetRunArray(0,length,run_array);
|
||||||
|
free(run_array);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user