aboutsummaryrefslogtreecommitdiff
path: root/generic/Text.c
diff options
context:
space:
mode:
authorlecoanet2002-07-05 15:05:45 +0000
committerlecoanet2002-07-05 15:05:45 +0000
commit19363923f319c9e7b6954831fcb9e8c4f5c3d8f3 (patch)
treece29c2cf4615a62d1f0feef08377e324b905ba10 /generic/Text.c
parent8b96bb04a6351fcce81cdbf17d88ba0db343bd25 (diff)
downloadtkzinc-19363923f319c9e7b6954831fcb9e8c4f5c3d8f3.zip
tkzinc-19363923f319c9e7b6954831fcb9e8c4f5c3d8f3.tar.gz
tkzinc-19363923f319c9e7b6954831fcb9e8c4f5c3d8f3.tar.bz2
tkzinc-19363923f319c9e7b6954831fcb9e8c4f5c3d8f3.tar.xz
Correction d'un core dump suite au patch pour affichage du curseur.
Protection systematique contre text_info pouvant �tre NULL. Dans Draw le curseur �tait affich� m�me quand le focus n'�tait pas sur l'item.
Diffstat (limited to 'generic/Text.c')
-rw-r--r--generic/Text.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/generic/Text.c b/generic/Text.c
index cec9102..998d9ee 100644
--- a/generic/Text.c
+++ b/generic/Text.c
@@ -513,8 +513,13 @@ ComputeCoordinates(Item item,
}
} /* ISSET(item->inv_flags, INV_TEXT_LAYOUT) */
- num_lines = ZnListSize(text->text_info);
- height = num_lines * font_height + (num_lines-1) * text->spacing;
+ if (text->text_info) {
+ num_lines = ZnListSize(text->text_info);
+ height = num_lines * font_height + (num_lines-1) * text->spacing;
+ }
+ else {
+ height = 0;
+ }
/*
* The connected item support anchors, this is checked by
@@ -763,7 +768,8 @@ Draw(Item item)
/*
* Setup the gc for the cursor and draw it.
*/
- if (cursor_line >= 0) {
+ if (cursor_line >= 0 &&
+ (wi->focus_item == item) && ti->cursor_on) {
int xs, ys;
values.fill_style = FillSolid;
@@ -991,7 +997,6 @@ Render(Item item)
}
}
glDisable(GL_TEXTURE_2D);
-
#endif
}
@@ -1258,6 +1263,9 @@ MoveFromIndex(TextItem text,
TextLineInfo lines, p;
char *strp;
+ if (!text->text_info) {
+ return index;
+ }
num_lines = ZnListSize(text->text_info);
lines = p = ZnListArray(text->text_info);
for (line_index = 0; line_index < num_lines; line_index++, p++) {