From 19363923f319c9e7b6954831fcb9e8c4f5c3d8f3 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 5 Jul 2002 15:05:45 +0000 Subject: 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. --- generic/Text.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'generic/Text.c') 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++) { -- cgit v1.1