SF.net SVN: geany: [1721] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Jul 18 12:20:15 UTC 2007
Revision: 1721
http://geany.svn.sourceforge.net/geany/?rev=1721&view=rev
Author: ntrel
Date: 2007-07-18 05:20:13 -0700 (Wed, 18 Jul 2007)
Log Message:
-----------
Fix possible segfault when a file is closed and using go forward.
Fix 2 possible memory leaks when files have been closed.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/navqueue.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-18 12:16:07 UTC (rev 1720)
+++ trunk/ChangeLog 2007-07-18 12:20:13 UTC (rev 1721)
@@ -2,6 +2,9 @@
* src/editor.c:
Fix gcc warning, add comment for editor_scroll_to_line().
+ * src/navqueue.c:
+ Fix possible segfault when a file is closed and using go forward.
+ Fix 2 possible memory leaks when files have been closed.
2007-07-17 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/src/navqueue.c
===================================================================
--- trunk/src/navqueue.c 2007-07-18 12:16:07 UTC (rev 1720)
+++ trunk/src/navqueue.c 2007-07-18 12:20:13 UTC (rev 1721)
@@ -121,13 +121,13 @@
}
nav_queue_pos = 0;
}
- /// TODO add check to not add an entry if "Go To Defintion" on a definition is used
g_queue_push_head(navigation_queue, npos);
adjust_buttons();
}
-/* line is counted with 1 as the first line, not 0. */
+/* Adds the current document position to the queue before adding the new position.
+ * line is counted with 1 as the first line, not 0. */
gboolean navqueue_append(gint new_idx, gint line)
{
gint old_idx = document_get_cur_idx();
@@ -169,7 +169,7 @@
else
{
/// TODO: add option to re open the file
- g_queue_pop_nth(navigation_queue, nav_queue_pos + 1);
+ g_free(g_queue_pop_nth(navigation_queue, nav_queue_pos + 1));
}
adjust_buttons();
}
@@ -179,7 +179,8 @@
{
filepos *fnext;
- if (nav_queue_pos < 1 || g_queue_get_length(navigation_queue) < 2)
+ if (nav_queue_pos < 1 ||
+ nav_queue_pos > g_queue_get_length(navigation_queue))
return;
// jump forward
@@ -191,7 +192,7 @@
else
{
/// TODO: add option to re open the file
- g_queue_pop_nth(navigation_queue, nav_queue_pos - 1);
+ g_free(g_queue_pop_nth(navigation_queue, nav_queue_pos - 1));
}
adjust_buttons();
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