Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gThumb
Commits
72c3f05d
Commit
72c3f05d
authored
Mar 24, 2012
by
Paolo Bacchilega
Browse files
fixed a good amount of memory leaks
parent
b51f6d66
Changes
30
Hide whitespace changes
Inline
Side-by-side
extensions/bookmarks/callbacks.c
View file @
72c3f05d
...
...
@@ -138,8 +138,10 @@ update_system_bookmark_list_from_content (GthBrowser *browser,
line
=
g_strsplit
(
lines
[
i
],
" "
,
2
);
uri
=
line
[
0
];
if
(
uri
==
NULL
)
if
(
uri
==
NULL
)
{
g_strfreev
(
line
);
continue
;
}
file
=
g_file_new_for_uri
(
uri
);
icon
=
_g_file_get_icon
(
file
);
...
...
@@ -159,7 +161,7 @@ update_system_bookmark_list_from_content (GthBrowser *browser,
-
1
);
g_free
(
name
);
g_object_unref
(
icon
);
_
g_object_unref
(
icon
);
g_object_unref
(
file
);
g_strfreev
(
line
);
}
...
...
extensions/cairo_io/cairo-io-png.c
View file @
72c3f05d
...
...
@@ -245,6 +245,7 @@ _cairo_image_surface_create_from_png (GthFileData *file_data,
if
(
cairo_surface_status
(
cairo_png_data
->
surface
)
==
CAIRO_STATUS_SUCCESS
)
gth_image_set_cairo_surface
(
image
,
cairo_png_data
->
surface
);
g_free
(
row_pointers
);
_cairo_png_data_destroy
(
cairo_png_data
);
return
image
;
...
...
extensions/catalogs/gth-catalog.c
View file @
72c3f05d
...
...
@@ -642,6 +642,8 @@ get_display_name (GFile *file,
}
}
g_free
(
basename
);
return
g_string_free
(
display_name
,
FALSE
);
}
...
...
@@ -675,6 +677,8 @@ get_edit_name (GFile *file,
g_string_append
(
display_name
,
name
);
}
g_free
(
basename
);
return
g_string_free
(
display_name
,
FALSE
);
}
...
...
@@ -695,6 +699,8 @@ update_standard_attributes (GFile *file,
sort_order_s
=
gth_datetime_strftime
(
date_time
,
"%Y%m%d"
);
sort_order
=
atoi
(
sort_order_s
);
g_file_info_set_sort_order
(
info
,
sort_order
);
g_free
(
sort_order_s
);
}
else
if
(
g_file_info_get_attribute_boolean
(
info
,
"gthumb::no-child"
))
g_file_info_set_sort_order
(
info
,
99999999
);
...
...
@@ -822,6 +828,7 @@ gth_catalog_file_to_gio_file (GFile *file)
full_uri
=
g_strconcat
(
base_uri
,
part
?
"/"
:
NULL
,
part
,
NULL
);
gio_file
=
g_file_new_for_uri
(
full_uri
);
g_free
(
full_uri
);
g_free
(
base_uri
);
g_object_unref
(
base
);
}
...
...
@@ -1158,7 +1165,8 @@ gth_catalog_save (GthCatalog *catalog)
gio_file
=
gth_catalog_file_to_gio_file
(
file
);
gio_parent
=
g_file_get_parent
(
gio_file
);
g_file_make_directory_with_parents
(
gio_parent
,
NULL
,
NULL
);
if
(
gio_parent
!=
NULL
)
g_file_make_directory_with_parents
(
gio_parent
,
NULL
,
NULL
);
data
=
gth_catalog_to_data
(
catalog
,
&
size
);
if
(
!
g_write_file
(
gio_file
,
FALSE
,
...
...
@@ -1198,6 +1206,6 @@ gth_catalog_save (GthCatalog *catalog)
}
g_free
(
data
);
g_object_unref
(
gio_parent
);
_
g_object_unref
(
gio_parent
);
g_object_unref
(
gio_file
);
}
extensions/catalogs/gth-file-source-catalogs.c
View file @
72c3f05d
...
...
@@ -71,14 +71,16 @@ update_file_info (GthFileSource *file_source,
GFile
*
catalog_file
,
GFileInfo
*
info
)
{
char
*
uri
;
char
*
uri
;
GIcon
*
icon
=
NULL
;
uri
=
g_file_get_uri
(
catalog_file
);
if
(
g_str_has_suffix
(
uri
,
".gqv"
)
||
g_str_has_suffix
(
uri
,
".catalog"
))
{
g_file_info_set_file_type
(
info
,
G_FILE_TYPE_DIRECTORY
);
g_file_info_set_content_type
(
info
,
"gthumb/catalog"
);
g_file_info_set_icon
(
info
,
g_themed_icon_new
(
"file-catalog"
));
icon
=
g_themed_icon_new
(
"file-catalog"
);
g_file_info_set_icon
(
info
,
icon
);
g_file_info_set_sort_order
(
info
,
1
);
g_file_info_set_attribute_boolean
(
info
,
"gthumb::no-child"
,
TRUE
);
gth_catalog_update_standard_attributes
(
catalog_file
,
info
);
...
...
@@ -86,7 +88,8 @@ update_file_info (GthFileSource *file_source,
else
if
(
g_str_has_suffix
(
uri
,
".search"
))
{
g_file_info_set_file_type
(
info
,
G_FILE_TYPE_DIRECTORY
);
g_file_info_set_content_type
(
info
,
"gthumb/search"
);
g_file_info_set_icon
(
info
,
g_themed_icon_new
(
"file-search"
));
icon
=
g_themed_icon_new
(
"file-search"
);
g_file_info_set_icon
(
info
,
icon
);
g_file_info_set_sort_order
(
info
,
1
);
g_file_info_set_attribute_boolean
(
info
,
"gthumb::no-child"
,
TRUE
);
gth_catalog_update_standard_attributes
(
catalog_file
,
info
);
...
...
@@ -94,12 +97,14 @@ update_file_info (GthFileSource *file_source,
else
{
g_file_info_set_file_type
(
info
,
G_FILE_TYPE_DIRECTORY
);
g_file_info_set_content_type
(
info
,
"gthumb/library"
);
g_file_info_set_icon
(
info
,
g_themed_icon_new
(
"file-library"
));
icon
=
g_themed_icon_new
(
"file-library"
);
g_file_info_set_icon
(
info
,
icon
);
g_file_info_set_sort_order
(
info
,
0
);
g_file_info_set_attribute_boolean
(
info
,
"gthumb::no-child"
,
FALSE
);
gth_catalog_update_standard_attributes
(
catalog_file
,
info
);
}
_g_object_unref
(
icon
);
g_free
(
uri
);
}
...
...
extensions/comments/gth-comment.c
View file @
72c3f05d
...
...
@@ -317,6 +317,7 @@ gth_comment_new_for_file (GFile *file,
comment
=
NULL
;
}
g_object_unref
(
doc
);
g_free
(
buffer
);
g_free
(
zipped_buffer
);
...
...
extensions/exiv2_tools/exiv2-utils.cpp
View file @
72c3f05d
...
...
@@ -392,7 +392,6 @@ set_attribute_from_metadata (GFileInfo *info,
const
char
*
attribute
,
GObject
*
metadata
)
{
char
*
key
;
char
*
description
;
char
*
formatted_value
;
char
*
raw_value
;
...
...
@@ -402,7 +401,6 @@ set_attribute_from_metadata (GFileInfo *info,
return
;
g_object_get
(
metadata
,
"id"
,
&
key
,
"description"
,
&
description
,
"formatted"
,
&
formatted_value
,
"raw"
,
&
raw_value
,
...
...
@@ -416,6 +414,11 @@ set_attribute_from_metadata (GFileInfo *info,
raw_value
,
NULL
,
type_name
);
g_free
(
description
);
g_free
(
formatted_value
);
g_free
(
raw_value
);
g_free
(
type_name
);
}
...
...
extensions/file_manager/callbacks.c
View file @
72c3f05d
...
...
@@ -1105,7 +1105,7 @@ _gth_browser_update_open_menu (GthBrowser *browser,
gtk_widget_show
(
openwith_item
);
g_hash_table_destroy
(
used_apps
);
g_list_
f
re
e
(
appinfo_list
);
_
g_
object_
list_
un
re
f
(
appinfo_list
);
_g_object_list_unref
(
file_list
);
_gtk_tree_path_list_free
(
items
);
}
...
...
extensions/selections/gth-selections-manager.c
View file @
72c3f05d
...
...
@@ -228,12 +228,20 @@ gth_selections_manager_update_file_info (GFile *file,
/* icon */
if
(
n_selection
>
0
)
{
GIcon
*
icon
;
name
=
g_strdup_printf
(
"selection%d"
,
n_selection
);
g_file_info_set_icon
(
info
,
g_themed_icon_new
(
name
));
icon
=
g_themed_icon_new
(
name
);
g_file_info_set_icon
(
info
,
icon
);
g_object_unref
(
icon
);
g_free
(
name
);
}
else
g_file_info_set_icon
(
info
,
g_themed_icon_new
(
"selection"
));
else
{
GIcon
*
icon
=
g_themed_icon_new
(
"selection"
);
g_file_info_set_icon
(
info
,
icon
);
g_object_unref
(
icon
);
}
/* display name */
...
...
gthumb/gio-utils.c
View file @
72c3f05d
...
...
@@ -201,9 +201,10 @@ for_each_child_data_free (ForEachChildData *fec)
return
;
g_object_unref
(
fec
->
base_directory
);
if
(
fec
->
already_visited
)
if
(
fec
->
already_visited
!=
NULL
)
g_hash_table_destroy
(
fec
->
already_visited
);
clear_child_data
(
&
(
fec
->
current
));
g_free
(
fec
->
attributes
);
if
(
fec
->
to_visit
!=
NULL
)
{
g_list_foreach
(
fec
->
to_visit
,
(
GFunc
)
child_data_free
,
NULL
);
g_list_free
(
fec
->
to_visit
);
...
...
gthumb/glib-utils.c
View file @
72c3f05d
...
...
@@ -1923,8 +1923,10 @@ _g_file_get_display_name (GFile *file)
G_FILE_QUERY_INFO_NONE
,
NULL
,
NULL
);
if
(
file_info
!=
NULL
)
if
(
file_info
!=
NULL
)
{
name
=
g_strdup
(
g_file_info_get_attribute_string
(
file_info
,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
));
g_object_unref
(
file_info
);
}
else
name
=
g_file_get_parse_name
(
file
);
...
...
@@ -2073,8 +2075,10 @@ _g_file_get_icon (GFile *file)
G_FILE_QUERY_INFO_NONE
,
NULL
,
NULL
);
if
(
file_info
!=
NULL
)
icon
=
(
GIcon
*
)
g_file_info_get_attribute_object
(
file_info
,
G_FILE_ATTRIBUTE_STANDARD_ICON
);
if
(
file_info
!=
NULL
)
{
icon
=
(
GIcon
*
)
g_object_ref
(
g_file_info_get_attribute_object
(
file_info
,
G_FILE_ATTRIBUTE_STANDARD_ICON
));
g_object_unref
(
file_info
);
}
if
(
icon
==
NULL
)
icon
=
g_themed_icon_new
(
"file"
);
...
...
gthumb/gnome-desktop-thumbnail.c
View file @
72c3f05d
...
...
@@ -1573,7 +1573,7 @@ read_png_options (const char *thumbnail_filename)
f
=
fopen
(
thumbnail_filename
,
"r"
);
if
(
f
==
NULL
)
{
png_destroy_read_struct
(
&
png_ptr
,
NULL
,
NULL
);
png_destroy_read_struct
(
&
png_ptr
,
&
info_ptr
,
NULL
);
return
options
;
}
...
...
gthumb/gth-browser.c
View file @
72c3f05d
...
...
@@ -3330,6 +3330,7 @@ pref_general_filter_changed (GSettings *settings,
filter
=
_gth_browser_get_file_filter
(
browser
);
gth_file_list_set_filter
(
GTH_FILE_LIST
(
browser
->
priv
->
file_list
),
filter
);
gth_file_list_set_filter
(
GTH_FILE_LIST
(
browser
->
priv
->
thumbnail_list
),
filter
);
g_object_unref
(
filter
);
}
...
...
@@ -4033,6 +4034,7 @@ gth_browser_init (GthBrowser *browser)
GtkWidget
*
menubar
;
GtkOrientation
viewer_thumbnails_orientation
;
char
*
general_filter
;
char
*
sort_type
;
char
*
caption
;
int
i
;
...
...
@@ -4410,8 +4412,9 @@ gth_browser_init (GthBrowser *browser)
/* the file list */
browser
->
priv
->
file_list
=
gth_file_list_new
(
gth_grid_view_new
(),
GTH_FILE_LIST_TYPE_NORMAL
,
TRUE
);
sort_type
=
g_settings_get_string
(
browser
->
priv
->
browser_settings
,
PREF_BROWSER_SORT_TYPE
);
gth_browser_set_sort_order
(
browser
,
gth_main_get_sort_type
(
g_settings_get_string
(
browser
->
priv
->
browser_settings
,
PREF_BROWSER_SORT_TYPE
)
),
gth_main_get_sort_type
(
sort_type
),
g_settings_get_boolean
(
browser
->
priv
->
browser_settings
,
PREF_BROWSER_SORT_INVERSE
));
gth_browser_enable_thumbnails
(
browser
,
g_settings_get_boolean
(
browser
->
priv
->
browser_settings
,
PREF_BROWSER_SHOW_THUMBNAILS
));
gth_file_list_set_thumb_size
(
GTH_FILE_LIST
(
browser
->
priv
->
file_list
),
...
...
@@ -4420,6 +4423,7 @@ gth_browser_init (GthBrowser *browser)
gth_file_list_set_caption
(
GTH_FILE_LIST
(
browser
->
priv
->
file_list
),
caption
);
g_free
(
caption
);
g_free
(
sort_type
);
gtk_widget_show
(
browser
->
priv
->
file_list
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
browser
->
priv
->
file_list
,
TRUE
,
TRUE
,
0
);
...
...
gthumb/gth-extensions.c
View file @
72c3f05d
...
...
@@ -452,8 +452,11 @@ gth_extension_description_load_from_file (GthExtensionDescription *desc,
key_file
=
g_key_file_new
();
file_path
=
g_file_get_path
(
file
);
if
(
!
g_key_file_load_from_file
(
key_file
,
file_path
,
G_KEY_FILE_NONE
,
NULL
))
if
(
!
g_key_file_load_from_file
(
key_file
,
file_path
,
G_KEY_FILE_NONE
,
NULL
))
{
g_free
(
file_path
);
g_key_file_free
(
key_file
);
return
FALSE
;
}
basename
=
g_file_get_basename
(
file
);
desc
->
id
=
_g_uri_remove_extension
(
basename
);
...
...
@@ -849,6 +852,7 @@ gth_extension_manager_order_extensions (GthExtensionManager *manager,
ordered_by_dependency
=
_g_list_prepend_link
(
ordered_by_dependency
,
link
);
}
}
g_list_free
(
dependencies
);
/* prepend the extension to the ordered list */
extension_list
=
g_list_remove_link
(
extension_list
,
scan
);
...
...
gthumb/gth-file-data.c
View file @
72c3f05d
...
...
@@ -548,6 +548,8 @@ gth_file_data_list_get_common_info (GList *file_data_list,
if
(
first_value
==
NULL
)
g_file_info_remove_attribute
(
info
,
attribute
);
g_free
(
first_value
);
}
g_strfreev
(
attributes_v
);
...
...
gthumb/gth-file-list.c
View file @
72c3f05d
...
...
@@ -1436,6 +1436,7 @@ thumbnail_job_ready_cb (GObject *source_object,
if
((
!
success
&&
g_error_matches
(
error
,
G_IO_ERROR
,
G_IO_ERROR_CANCELLED
))
||
file_list
->
priv
->
cancelling
)
{
_g_object_unref
(
pixbuf
);
thumbnail_job_free
(
job
);
return
;
}
...
...
gthumb/gth-file-store.c
View file @
72c3f05d
...
...
@@ -144,11 +144,11 @@ _gth_file_row_copy (GthFileRow *row)
}
G_GNUC_UNUSED
static
void
static
GthFileRow
*
_gth_file_row_ref
(
GthFileRow
*
row
)
{
row
->
ref_count
++
;
return
row
;
}
...
...
@@ -169,6 +169,7 @@ _gth_file_row_unref (GthFileRow *row)
static
void
_gth_file_store_clear_queue
(
GthFileStore
*
file_store
)
{
g_list_foreach
(
file_store
->
priv
->
queue
,
(
GFunc
)
_gth_file_row_unref
,
NULL
);
g_list_free
(
file_store
->
priv
->
queue
);
file_store
->
priv
->
queue
=
NULL
;
}
...
...
@@ -803,7 +804,7 @@ g_print ("UPDATE VISIBILITY\n");
for
(
i
=
0
;
i
<
position
;
i
++
)
all_rows
[
j
++
]
=
_gth_file_row_copy
(
file_store
->
priv
->
all_rows
[
i
]);
for
(
scan
=
add_queue
;
scan
;
scan
=
scan
->
next
)
all_rows
[
j
++
]
=
(
GthFileRow
*
)
scan
->
data
;
all_rows
[
j
++
]
=
_gth_file_row_ref
(
(
GthFileRow
*
)
scan
->
data
)
;
for
(
i
=
position
;
i
<
file_store
->
priv
->
tot_rows
;
i
++
)
all_rows
[
j
++
]
=
_gth_file_row_copy
(
file_store
->
priv
->
all_rows
[
i
]);
...
...
@@ -1565,7 +1566,7 @@ gth_file_store_queue_remove (GthFileStore *file_store,
row
=
(
GthFileRow
*
)
iter
->
user_data
;
file_store
->
priv
->
queue
=
g_list_prepend
(
file_store
->
priv
->
queue
,
file_store
->
priv
->
all_rows
[
row
->
abs_pos
]);
file_store
->
priv
->
queue
=
g_list_prepend
(
file_store
->
priv
->
queue
,
_gth_file_row_ref
(
file_store
->
priv
->
all_rows
[
row
->
abs_pos
])
)
;
}
...
...
gthumb/gth-filter-file.c
View file @
72c3f05d
...
...
@@ -53,6 +53,8 @@ gth_filter_file_new (void)
void
gth_filter_file_free
(
GthFilterFile
*
filters
)
{
if
(
filters
==
NULL
)
return
;
_g_object_list_unref
(
filters
->
items
);
g_free
(
filters
);
}
...
...
gthumb/gth-filter.c
View file @
72c3f05d
...
...
@@ -137,6 +137,8 @@ gth_filter_real_load_from_element (DomDomizable *base,
test
=
gth_test_chain_new
(
GTH_MATCH_TYPE_NONE
,
NULL
);
dom_domizable_load_from_element
(
DOM_DOMIZABLE
(
test
),
node
);
gth_filter_set_test
(
self
,
GTH_TEST_CHAIN
(
test
));
g_object_unref
(
test
);
}
else
if
(
g_strcmp0
(
node
->
tag_name
,
"limit"
)
==
0
)
{
gth_filter_set_limit
(
self
,
...
...
gthumb/gth-image-loader.c
View file @
72c3f05d
...
...
@@ -204,17 +204,18 @@ load_pixbuf_thread (GSimpleAsyncResult *result,
error
=
g_error_new_literal
(
G_IO_ERROR
,
G_IO_ERROR_NOT_SUPPORTED
,
_
(
"No suitable loader available for this file type"
));
}
load_result
=
g_new0
(
LoadResult
,
1
);
load_result
->
image
=
image
;
load_result
->
original_width
=
original_width
;
load_result
->
original_height
=
original_height
;
if
(
error
!=
NULL
)
{
_g_object_unref
(
image
);
g_simple_async_result_set_from_error
(
result
,
error
);
g_error_free
(
error
);
return
;
}
else
g_simple_async_result_set_op_res_gpointer
(
result
,
load_result
,
(
GDestroyNotify
)
load_result_unref
);
load_result
=
g_new0
(
LoadResult
,
1
);
load_result
->
image
=
image
;
load_result
->
original_width
=
original_width
;
load_result
->
original_height
=
original_height
;
g_simple_async_result_set_op_res_gpointer
(
result
,
load_result
,
(
GDestroyNotify
)
load_result_unref
);
}
...
...
gthumb/gth-image-viewer.c
View file @
72c3f05d
...
...
@@ -169,6 +169,7 @@ gth_image_viewer_finalize (GObject *object)
}
g_list_foreach
(
self
->
priv
->
painters
,
(
GFunc
)
painter_data_free
,
NULL
);
_g_object_unref
(
self
->
priv
->
tool
);
_g_clear_object
(
&
self
->
priv
->
image
);
_g_clear_object
(
&
self
->
priv
->
animation
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment