aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/PropSet.cxx5
-rw-r--r--src/Style.cxx9
-rw-r--r--src/ViewStyle.cxx8
3 files changed, 15 insertions, 7 deletions
diff --git a/src/PropSet.cxx b/src/PropSet.cxx
index 7e2a906a4..8582105ea 100644
--- a/src/PropSet.cxx
+++ b/src/PropSet.cxx
@@ -27,6 +27,7 @@ bool EqualCaseInsensitive(const char *a, const char *b) {
// Get a line of input. If end of line escaped with '\\' then continue reading.
static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
bool continuation = true;
+ s[0] = '\0';
while ((len > 1) && lenData > 0) {
char ch = *fpc;
fpc++;
@@ -46,6 +47,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
} else {
continuation = false;
*s++ = ch;
+ *s = '\0';
len--;
}
}
@@ -253,6 +255,9 @@ void PropSet::ReadFromMemory(const char *data, int len) {
if (isalpha(linebuf[0]))
Set(linebuf);
}
+ // If there is a final line:
+ if (isalpha(linebuf[0]))
+ Set(linebuf);
}
}
diff --git a/src/Style.cxx b/src/Style.cxx
index 271d98fc2..120fd6e95 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -10,6 +10,7 @@
#include "Style.h"
Style::Style() {
+ aliasOfDefaultFont = false;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
Platform::DefaultFontSize(), 0,
false, false, false);
@@ -18,11 +19,14 @@ Style::Style() {
Style::~Style() {
if (!aliasOfDefaultFont)
font.Release();
+ aliasOfDefaultFont = false;
}
Style &Style::operator=(const Style &source) {
if (this == &source)
return *this;
+ // Crash:
+ *(char *)0 = 1;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
Platform::DefaultFontSize(), 0,
false, false, false);
@@ -47,6 +51,8 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
eolFilled = eolFilled_;
if (!aliasOfDefaultFont)
font.Release();
+ else
+ font.SetID(0);
aliasOfDefaultFont = false;
}
@@ -68,7 +74,8 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
int sizeZoomed = size + zoomLevel;
if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
sizeZoomed = 2;
-
+
+ font.Release();
int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
aliasOfDefaultFont = defaultStyle && EquivalentFontTo(defaultStyle);
if (aliasOfDefaultFont) {
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 122db6a00..976593de3 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -51,7 +51,7 @@ ViewStyle::ViewStyle() {
ViewStyle::ViewStyle(const ViewStyle &source) {
Init();
- for (int sty=0;sty<=STYLE_MAX;sty++) {
+ for (unsigned int sty=0;sty<(sizeof(styles)/sizeof(styles[0]));sty++) {
styles[sty] = source.styles[sty];
}
for (int mrk=0;mrk<=MARKER_MAX;mrk++) {
@@ -163,9 +163,7 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(edgecolour, want);
}
-#include <mmsystem.h>
void ViewStyle::Refresh(Surface &surface) {
-DWORD dwStart = timeGetTime();
selbar.desired = Platform::Chrome();
selbarlight.desired = Platform::ChromeHighlight();
maxAscent = 1;
@@ -194,8 +192,6 @@ DWORD dwStart = timeGetTime();
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
-DWORD dwEnd = timeGetTime();
-Platform::DebugPrintf("Refresh took %d\n", dwEnd - dwStart);
}
void ViewStyle::ResetDefaultStyle() {
@@ -206,7 +202,7 @@ void ViewStyle::ResetDefaultStyle() {
void ViewStyle::ClearStyles() {
// Reset all styles to be like the default style
- for (int i=0; i<=STYLE_MAX; i++) {
+ for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
if (i != STYLE_DEFAULT) {
styles[i].Clear(
styles[STYLE_DEFAULT].fore.desired,