From 7f44228903768dbae972ce7222654d1918f450b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Fri, 17 Mar 2006 02:25:39 +0000 Subject: [PATCH] typing } on lines longer than 256 chars caused a crash git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@254 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- src/sci_cb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sci_cb.c b/src/sci_cb.c index b40f8499..d4b11b55 100644 --- a/src/sci_cb.c +++ b/src/sci_cb.c @@ -290,11 +290,12 @@ void sci_cb_close_block(ScintillaObject *sci, gint pos) gint eol_char_len = (line == (SSM(sci, SCI_GETLINECOUNT, 0, 0) - 1)) ? 0 : utils_get_eol_char_len(document_find_by_sci(sci)); gint lexer = SSM(sci, SCI_GETLEXER, 0, 0); - gchar *text, line_buf[255]; + gchar *text, *line_buf; if (lexer != SCLEX_CPP && lexer != SCLEX_HTML && lexer != SCLEX_PASCAL) return; // check that the line is empty, to not kill text in the line + line_buf = g_malloc(line_len + 1); sci_get_line(sci, line, line_buf); line_buf[line_len - eol_char_len] = '\0'; while (x < (line_len - eol_char_len)) @@ -302,6 +303,8 @@ void sci_cb_close_block(ScintillaObject *sci, gint pos) if (isspace(line_buf[x])) cnt++; x++; } + g_free(line_buf); + //geany_debug("line_len: %d eol: %d cnt: %d", line_len, eol_char_len, cnt); if ((line_len - eol_char_len - 1) != cnt) return;