SF.net SVN: geany:[3546] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Feb 4 20:01:32 UTC 2009


Revision: 3546
          http://geany.svn.sourceforge.net/geany/?rev=3546&view=rev
Author:   eht16
Date:     2009-02-04 20:01:32 +0000 (Wed, 04 Feb 2009)

Log Message:
-----------
Fix a crash on Windows for PHP files when 'comment_close' in not set (neither in the user's config nor in the global filetypes.php) and (un)commenting is used outside of the PHP tags (reported by Frank, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/editor.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-02-04 19:52:44 UTC (rev 3545)
+++ trunk/ChangeLog	2009-02-04 20:01:32 UTC (rev 3546)
@@ -2,6 +2,11 @@
 
  * src/vte.c, src/vte.h:
    Some code cleanup and improve comments, no changes in functionality.
+ * src/editor.c:
+   Fix a crash on Windows for PHP files when 'comment_close' in not set
+   (neither in the user's config nor in the global filetypes.php) and
+   (un)commenting is used outside of the PHP tags
+   (reported by Frank, thanks).
 
 
 2009-02-02  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2009-02-04 19:52:44 UTC (rev 3545)
+++ trunk/src/editor.c	2009-02-04 20:01:32 UTC (rev 3546)
@@ -2262,15 +2262,17 @@
 static void real_comment_multiline(GeanyEditor *editor, gint line_start, gint last_line)
 {
 	const gchar *eol;
-	gchar *str_begin, *str_end;
+	gchar *str_begin, *str_end, *co, *cc;
 	gint line_len;
 
 	if (editor == NULL || editor->document->file_type == NULL)
 		return;
 
 	eol = editor_get_eol_char(editor);
-	str_begin = g_strdup_printf("%s%s", editor->document->file_type->comment_open, eol);
-	str_end = g_strdup_printf("%s%s", editor->document->file_type->comment_close, eol);
+	co = editor->document->file_type->comment_open;
+	cc = editor->document->file_type->comment_close;
+	str_begin = g_strdup_printf("%s%s", (co != NULL) ? co : "", eol);
+	str_end = g_strdup_printf("%s%s", (cc != NULL) ? cc : "", eol);
 
 	/* insert the comment strings */
 	sci_insert_text(editor->sci, line_start, str_begin);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list