Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: GitHub noreply@github.com Date: Mon, 10 Apr 2017 17:16:43 UTC Commit: fd94a04db16a50e0f5021b3adbcdf43801a08c41 https://github.com/geany/geany-plugins/commit/fd94a04db16a50e0f5021b3adbcdf4...
Log Message: ----------- Merge pull request #559 from techee/prjorg_crash_fix2
Fix crash in projectorganizer's crash-fix
Modified Paths: -------------- projectorganizer/src/prjorg-sidebar.c
Modified: projectorganizer/src/prjorg-sidebar.c 32 lines changed, 23 insertions(+), 9 deletions(-) =================================================================== @@ -48,6 +48,13 @@ typedef enum MATCH_PATTERN } MatchType;
+typedef struct +{ + GeanyProject *project; + GPtrArray *expanded_paths; +} ExpandData; + + static GdkColor s_external_color; static GtkWidget *s_toolbar = NULL; static gboolean s_pending_reload = FALSE; @@ -1210,22 +1217,27 @@ static gboolean expand_path(gchar *utf8_expanded_path, gboolean select) }
-static gboolean expand_on_idle(gpointer ptr) +static gboolean expand_on_idle(ExpandData *expand_data) { GeanyDocument *doc = document_get_current();
- if (ptr) + if (!prj_org) + return FALSE; + + if (geany_data->app->project == expand_data->project && + expand_data->expanded_paths) { - GPtrArray *expanded_paths = ptr; gchar *item; guint i;
- foreach_ptr_array(item, i, expanded_paths) + foreach_ptr_array(item, i, expand_data->expanded_paths) expand_path(item, FALSE); - g_ptr_array_free(expanded_paths, TRUE); + g_ptr_array_free(expand_data->expanded_paths, TRUE); }
- if (!s_follow_editor || !doc || !doc->file_name || !geany_data->app->project || !prj_org) + g_free(expand_data); + + if (!s_follow_editor || !doc || !doc->file_name) return FALSE;
expand_path(doc->file_name, TRUE); @@ -1281,11 +1293,13 @@ static GPtrArray *get_expanded_paths(void)
void prjorg_sidebar_update(gboolean reload) { - GPtrArray *expanded_paths = NULL; + ExpandData *expand_data = g_new0(ExpandData, 1); + + expand_data->project = geany_data->app->project;
if (reload) { - expanded_paths = get_expanded_paths(); + expand_data->expanded_paths = get_expanded_paths();
load_project(); /* we get color information only after the sidebar is realized - @@ -1295,7 +1309,7 @@ void prjorg_sidebar_update(gboolean reload) }
/* perform on idle - avoids unnecessary jumps on project load */ - plugin_idle_add(geany_plugin, (GSourceFunc)expand_on_idle, expanded_paths); + plugin_idle_add(geany_plugin, (GSourceFunc)expand_on_idle, expand_data); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org