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); g_free(priv->bookmark_path);
priv->bookmark_path = NULL; priv->bookmark_path = NULL;
if (priv->bookmark_monitor != NULL) { g_clear_object(&priv->bookmark_monitor);
g_object_unref(priv->bookmark_monitor);
priv->bookmark_monitor = NULL;
}
if (priv->bookmarks != NULL) { if (priv->bookmarks != NULL) {
g_key_file_free(priv->bookmarks); g_key_file_free(priv->bookmarks);
@ -260,10 +257,7 @@ error_free:
g_free(priv->history_path); g_free(priv->history_path);
priv->history_path = NULL; priv->history_path = NULL;
if (priv->history_monitor != NULL) { g_clear_object(&priv->history_monitor);
g_object_unref(priv->history_monitor);
priv->history_monitor = NULL;
}
if (priv->history != NULL) { if (priv->history != NULL) {
g_key_file_free(priv->history); 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); document->uri = g_strdup(uri);
if (document->uri == NULL) { if (document->uri == NULL) {
document->basename = g_file_get_basename(file); document->basename = g_file_get_basename(file);
} } else {
else {
GFile *gf = g_file_new_for_uri(document->uri); GFile *gf = g_file_new_for_uri(document->uri);
document->basename = g_file_get_basename(gf); document->basename = g_file_get_basename(gf);
g_object_unref(gf); g_object_unref(gf);

View file

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