[Xfce4-commits] <ristretto:master> Solve segfault (should not unref rstto_file objects)
Stephan Arts
noreply at xfce.org
Mon Nov 28 22:38:01 CET 2011
Updating branch refs/heads/master
to eb0774d0597c4c42d90e686674f76c60b7cd5170 (commit)
from ed60d6427e912f393e97de4b09f447efa781e601 (commit)
commit eb0774d0597c4c42d90e686674f76c60b7cd5170
Author: Stephan Arts <stephan at xfce.org>
Date: Mon Nov 28 22:35:21 2011 +0100
Solve segfault (should not unref rstto_file objects)
Need to get a closer look at this, reference-counting
of these objects is a mess, should be overhauled and fixed.
src/file.c | 6 +++++-
src/main.c | 2 --
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/file.c b/src/file.c
index 4acc89f..b36ee43 100644
--- a/src/file.c
+++ b/src/file.c
@@ -202,8 +202,9 @@ rstto_file_new ( GFile *file )
/* Check if the file is already opened, if so
* return that one.
*/
+ o_file = RSTTO_FILE (iter->data);
if ( TRUE == g_file_equal (
- RSTTO_FILE (iter->data)->priv->file,
+ o_file->priv->file,
file) )
{
return (RsttoFile *)iter->data;
@@ -282,6 +283,9 @@ rstto_file_get_display_name ( RsttoFile *file )
const gchar *
rstto_file_get_path ( RsttoFile *file )
{
+ g_return_val_if_fail (RSTTO_IS_FILE (file), NULL);
+ g_return_val_if_fail (G_IS_FILE (file->priv->file), NULL);
+
if ( NULL == file->priv->path )
{
file->priv->path = g_file_get_path (file->priv->file);
diff --git a/src/main.c b/src/main.c
index 69f4b8d..78009df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -206,7 +206,6 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
}
}
- g_object_unref (file);
}
rof->iter++;
return TRUE;
@@ -232,7 +231,6 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
/* TODO: show error dialog */
}
}
- g_object_unref (file);
}
if (file_type != G_FILE_TYPE_DIRECTORY && r_file != NULL)
More information about the Xfce4-commits
mailing list