brasero r1534 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1534 - in trunk: . src
- Date: Sun, 16 Nov 2008 21:04:07 +0000 (UTC)
Author: philippr
Date: Sun Nov 16 21:04:07 2008
New Revision: 1534
URL: http://svn.gnome.org/viewvc/brasero?rev=1534&view=rev
Log:
Fix #Bug 560153 -- brasero crashed with SIGSEGV in brasero_data_project_node_to_uri()
Avoid crashing + Fix a warning
* src/brasero-data-project.c (brasero_data_project_create_path),
(brasero_data_project_add_path),
(brasero_data_project_load_contents_notify_directory),
(brasero_data_project_load_contents_notify),
(brasero_data_project_load_contents):
* src/brasero-data-vfs.c (brasero_data_vfs_loading_node),
(brasero_data_vfs_node_added):
* src/brasero-project.c (brasero_project_open_project):
Modified:
trunk/ChangeLog
trunk/src/brasero-data-project.c
trunk/src/brasero-data-vfs.c
trunk/src/brasero-project.c
Modified: trunk/src/brasero-data-project.c
==============================================================================
--- trunk/src/brasero-data-project.c (original)
+++ trunk/src/brasero-data-project.c Sun Nov 16 21:04:07 2008
@@ -2616,9 +2616,6 @@
* isn't one. */
parent->is_tmp_parent = TRUE;
- /* Increment it by 2 (loading folder and then its contents) */
- priv->loading += 2;
-
(*folders) = g_slist_prepend ((*folders), parent);
/* Go on with the next; skip the separator */
@@ -2738,9 +2735,6 @@
node->is_loading = FALSE;
node->is_reloading = FALSE;
- /* decrement that since we're not going to load anything */
- priv->loading -= 2;
-
/* Don't signal the node addition yet we'll do it later
* when all the nodes are created */
}
@@ -2750,9 +2744,6 @@
node->is_loading = TRUE;
node->is_reloading = FALSE;
- /* No need to increment priv->loading here since that
- * was done at the creation of the temporary folder */
-
/* Don't signal the node addition yet we'll do it later
* when all the nodes are created */
}
@@ -2766,13 +2757,8 @@
/* don't use brasero_data_project_add_loading_node since that way:
* - we don't check for sibling
* - we set right from the start the right name */
- if (uri != NEW_FOLDER) {
+ if (uri != NEW_FOLDER)
node = brasero_file_node_new_loading (path, parent, priv->sort_func);
-
- /* Set loading counter to 2: 1 operation for loading the graft
- * point and 1 for loading its contents if that's a folder. */
- priv->loading += 2;
- }
else
node = brasero_file_node_new_empty_folder (path, parent, priv->sort_func);
@@ -2882,48 +2868,76 @@
return folders;
}
-static void
+static gint
brasero_data_project_load_contents_notify_directory (BraseroDataProject *self,
BraseroFileNode *parent,
BraseroDataNodeAddedFunc func)
{
BraseroFileNode *child;
+ gint num = 0;
child = BRASERO_FILE_NODE_CHILDREN (parent);
while (child) {
- gchar *uri;
+ gboolean res;
+ BraseroFileNode *next;
- uri = brasero_data_project_node_to_uri (self, child);
- func (self, child, uri != NEW_FOLDER? uri:NULL);
- g_free (uri);
+ /* The child could be removed during the process */
+ next = child->next;
+
+ /**
+ * This is to get the number of operations remaining before the
+ * whole project is loaded.
+ * +1 for loading information about a file or a directory (that
+ * means they must not be fake).
+ * +1 for loading the directory contents.
+ */
+ if (!child->is_fake) {
+ gchar *uri;
+
+ uri = brasero_data_project_node_to_uri (self, child);
+ res = func (self, child, uri);
+ g_free (uri);
+
+ if (res)
+ num ++;
+ }
+ else
+ res = func (self, child, NULL);
- if (!child->is_file)
- brasero_data_project_load_contents_notify_directory (self,
- child,
- func);
+ /* for whatever reason the node could have been invalidated */
+ if (res && !child->is_file) {
+ num ++;
+ num += brasero_data_project_load_contents_notify_directory (self,
+ child,
+ func);
+ }
- child = child->next;
+ child = next;
}
+
+ return num;
}
-static void
+static gint
brasero_data_project_load_contents_notify (BraseroDataProject *self)
{
+ gint num;
BraseroDataProjectClass *klass;
BraseroDataProjectPrivate *priv;
klass = BRASERO_DATA_PROJECT_GET_CLASS (self);
if (!klass->node_added)
- return;
+ return 0;
priv = BRASERO_DATA_PROJECT_PRIVATE (self);
/* we'll notify for every single node in the tree starting from the top.
* NOTE: at this point there are only grafted nodes (fake or not) in the
* tree. */
- brasero_data_project_load_contents_notify_directory (self,
- priv->root,
- klass->node_added);
+ num = brasero_data_project_load_contents_notify_directory (self,
+ priv->root,
+ klass->node_added);
+ return num;
}
guint
@@ -2977,13 +2991,10 @@
tmp->is_fake = TRUE;
tmp->is_loading = FALSE;
tmp->is_reloading = FALSE;
- //tmp->is_tmp_parent = FALSE;
graft = brasero_data_project_uri_ensure_graft (self, NEW_FOLDER);
brasero_file_node_graft (tmp, graft);
- priv->loading -= 2;
-
/* Don't signal the node addition yet we'll do it later
* when all the nodes are created */
@@ -3000,10 +3011,9 @@
}
g_slist_free (folders);
- brasero_data_project_load_contents_notify (self);
+ priv->loading = brasero_data_project_load_contents_notify (self);
priv->is_loading_contents = 0;
-
return priv->loading;
}
Modified: trunk/src/brasero-data-vfs.c
==============================================================================
--- trunk/src/brasero-data-vfs.c (original)
+++ trunk/src/brasero-data-vfs.c Sun Nov 16 21:04:07 2008
@@ -815,16 +815,13 @@
gchar *name;
GFile *vfs_uri;
- /* g_path_get_basename is not comfortable with uri related
- * to the root directory so check that before */
vfs_uri = g_file_new_for_uri (uri);
name = g_file_get_basename (vfs_uri);
g_object_unref (vfs_uri);
-
/* NOTE and reminder names are already unescaped; the following
- * is not needed: unescaped_name = g_uri_unescape_string (name,
- * NULL); */
+ * is not needed:
+ * unescaped_name = g_uri_unescape_string (name, NULL); */
if (!name)
return TRUE;
@@ -1019,7 +1016,8 @@
if (brasero_data_vfs_loading_node (self, node, uri))
goto chain;
- goto chain;
+ /* The node was invalidated. So there's no need to pass it on */
+ return FALSE;
}
/* NOTE: a symlink pointing to a directory will return TRUE. */
Modified: trunk/src/brasero-project.c
==============================================================================
--- trunk/src/brasero-project.c (original)
+++ trunk/src/brasero-project.c Sun Nov 16 21:04:07 2008
@@ -2105,15 +2105,17 @@
brasero_project_switch (project, type);
- g_signal_handlers_block_by_func (project->priv->name_display,
- brasero_project_name_changed_cb,
- project);
- gtk_entry_set_text (GTK_ENTRY (project->priv->name_display), label);
- g_free (label);
+ if (label) {
+ g_signal_handlers_block_by_func (project->priv->name_display,
+ brasero_project_name_changed_cb,
+ project);
+ gtk_entry_set_text (GTK_ENTRY (project->priv->name_display), label);
+ g_free (label);
- g_signal_handlers_unblock_by_func (project->priv->name_display,
- brasero_project_name_changed_cb,
- project);
+ g_signal_handlers_unblock_by_func (project->priv->name_display,
+ brasero_project_name_changed_cb,
+ project);
+ }
brasero_disc_load_track (project->priv->current, track);
brasero_track_free (track);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]