Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2017-03-17 17:58:55 +01:00
parent 49aa419568
commit 63314cfbc9
4 changed files with 11 additions and 36 deletions

View File

@ -246,10 +246,7 @@ error_free:
g_free(priv->bookmark_path);
priv->bookmark_path = NULL;
if (priv->bookmark_monitor != NULL) {
g_object_unref(priv->bookmark_monitor);
priv->bookmark_monitor = NULL;
}
g_clear_object(&priv->bookmark_monitor);
if (priv->bookmarks != NULL) {
g_key_file_free(priv->bookmarks);
@ -260,10 +257,7 @@ error_free:
g_free(priv->history_path);
priv->history_path = NULL;
if (priv->history_monitor != NULL) {
g_object_unref(priv->history_monitor);
priv->history_monitor = NULL;
}
g_clear_object(&priv->history_monitor);
if (priv->history != NULL) {
g_key_file_free(priv->history);

View File

@ -119,8 +119,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* uri,
document->uri = g_strdup(uri);
if (document->uri == NULL) {
document->basename = g_file_get_basename(file);
}
else {
} else {
GFile *gf = g_file_new_for_uri(document->uri);
document->basename = g_file_get_basename(gf);
g_object_unref(gf);

View File

@ -215,12 +215,8 @@ cb_print_done(GtkPrintOperation* operation, GtkPrintOperationResult result,
zathura_t* zathura)
{
if (result == GTK_PRINT_OPERATION_RESULT_APPLY) {
if (zathura->print.settings != NULL) {
g_object_unref(zathura->print.settings);
}
if (zathura->print.page_setup != NULL) {
g_object_unref(zathura->print.page_setup);
}
g_clear_object(&zathura->print.settings);
g_clear_object(&zathura->print.page_setup);
/* save previous settings */
zathura->print.settings = g_object_ref(gtk_print_operation_get_print_settings(operation));

View File

@ -391,10 +391,7 @@ zathura_free(zathura_t* zathura)
#endif
/* stop D-Bus */
if (zathura->dbus != NULL) {
g_object_unref(zathura->dbus);
zathura->dbus = NULL;
}
g_clear_object(&zathura->dbus);
if (zathura->ui.session != NULL) {
girara_session_destroy(zathura->ui.session);
@ -415,18 +412,11 @@ zathura_free(zathura_t* zathura)
girara_list_free(zathura->bookmarks.bookmarks);
/* database */
if (zathura->database != NULL) {
g_object_unref(G_OBJECT(zathura->database));
}
g_clear_object(&zathura->database);
/* free print settings */
if (zathura->print.settings != NULL) {
g_object_unref(zathura->print.settings);
}
if (zathura->print.page_setup != NULL) {
g_object_unref(zathura->print.page_setup);
}
g_clear_object(&zathura->print.settings);
g_clear_object(&zathura->print.page_setup);
/* free registered plugins */
zathura_plugin_manager_free(zathura->plugins.manager);
@ -1216,10 +1206,7 @@ document_close(zathura_t* zathura, bool keep_monitor)
/* remove monitor */
if (keep_monitor == false) {
if (zathura->file_monitor.monitor != NULL) {
g_object_unref(zathura->file_monitor.monitor);
zathura->file_monitor.monitor = NULL;
}
g_clear_object(&zathura->file_monitor.monitor);
if (zathura->file_monitor.password != NULL) {
g_free(zathura->file_monitor.password);
@ -1245,8 +1232,7 @@ document_close(zathura_t* zathura, bool keep_monitor)
zathura->jumplist.size = 0;
/* release render thread */
g_object_unref(zathura->sync.render_thread);
zathura->sync.render_thread = NULL;
g_clear_object(&zathura->sync.render_thread);
/* remove widgets */
gtk_container_foreach(GTK_CONTAINER(zathura->ui.page_widget), remove_page_from_table, NULL);