From 02725597fea4c163e7066ca8301ecc3371023e2a8ca3b92c981633e66786b90d Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Mon, 23 Apr 2018 09:28:03 +0000 Subject: [PATCH] Accepting request 599797 from home:iznogood:branches:GNOME:Factory Add upstream bug fix patches OBS-URL: https://build.opensuse.org/request/show/599797 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/bijiben?expand=0&rev=86 --- bijiben-memory-leak-fixes.patch | 181 +++++++++++++++++++++ bijiben-settings-dialog-Fix-settings.patch | 68 ++++++++ bijiben-webkit-editor_Use-g_auto.patch | 125 ++++++++++++++ bijiben.changes | 8 + bijiben.spec | 10 +- 5 files changed, 390 insertions(+), 2 deletions(-) create mode 100644 bijiben-memory-leak-fixes.patch create mode 100644 bijiben-settings-dialog-Fix-settings.patch create mode 100644 bijiben-webkit-editor_Use-g_auto.patch diff --git a/bijiben-memory-leak-fixes.patch b/bijiben-memory-leak-fixes.patch new file mode 100644 index 0000000..51495fd --- /dev/null +++ b/bijiben-memory-leak-fixes.patch @@ -0,0 +1,181 @@ +From e3eeef938872031fa67226ca2fe385f9fb81c636 Mon Sep 17 00:00:00 2001 +From: Isaque Galdino +Date: Mon, 16 Apr 2018 13:11:47 -0300 +Subject: settings: Fix memory leak + +BjbSettings is self referencing due to g_setting_bind. + +This patch removes that binding and add code to load settings. +--- + src/bjb-settings.c | 25 +++++++++---------------- + 1 file changed, 9 insertions(+), 16 deletions(-) + +diff --git a/src/bjb-settings.c b/src/bjb-settings.c +index a8af12e..b1ce7a5 100644 +--- a/src/bjb-settings.c ++++ b/src/bjb-settings.c +@@ -115,26 +115,31 @@ bjb_settings_set_property (GObject *object, + GParamSpec *pspec) + { + BjbSettings *self = BJB_SETTINGS (object); ++ GSettings *settings = G_SETTINGS (object); + + switch (prop_id) + { + case PROP_USE_SYSTEM_FONT: + self->use_system_font = g_value_get_boolean (value); ++ g_settings_set_boolean (settings, "use-system-font", self->use_system_font); + break; + + case PROP_FONT: + g_free (self->font); + self->font = g_value_dup_string (value); ++ g_settings_set_string (settings, "font", self->font); + break; + + case PROP_COLOR: + g_free (self->color); + self->color = g_value_dup_string (value); ++ g_settings_set_string (settings, "color", self->color); + break; + + case PROP_PRIMARY: + g_free (self->primary); + self->primary = g_value_dup_string (value); ++ g_settings_set_string (settings, "default-location", self->primary); + break; + + default: +@@ -156,22 +161,10 @@ bjb_settings_constructed (GObject *object) + settings = G_SETTINGS (object); + self->system = g_settings_new ("org.gnome.desktop.interface"); + +- +- g_settings_bind (settings, "use-system-font", +- self, "use-system-font", +- G_SETTINGS_BIND_DEFAULT); +- +- g_settings_bind (settings, "font", +- self, "font", +- G_SETTINGS_BIND_DEFAULT); +- +- g_settings_bind (settings, "color", +- self, "color", +- G_SETTINGS_BIND_DEFAULT); +- +- g_settings_bind (settings, "default-location", +- self, "default-location", +- G_SETTINGS_BIND_DEFAULT); ++ self->use_system_font = g_settings_get_boolean (settings, "use-system-font"); ++ self->font = g_settings_get_string (settings, "font"); ++ self->color = g_settings_get_string (settings, "color"); ++ self->primary = g_settings_get_string (settings, "default-location"); + } + + +-- +cgit v0.12 + + +From 0c7061de9e2987de351c30dae28a5b749cd525fc Mon Sep 17 00:00:00 2001 +From: Isaque Galdino +Date: Mon, 16 Apr 2018 17:51:02 -0300 +Subject: item: Fix memory leak + +--- + src/libbiji/biji-item.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/libbiji/biji-item.c b/src/libbiji/biji-item.c +index a96bfb2..ae8aa7e 100644 +--- a/src/libbiji/biji-item.c ++++ b/src/libbiji/biji-item.c +@@ -151,7 +151,8 @@ biji_item_class_init (BijiItemClass *klass) + static void + biji_item_finalize (GObject *object) + { +- g_return_if_fail (BIJI_IS_ITEM (object)); ++ BijiItemPrivate *priv = biji_item_get_instance_private (BIJI_ITEM (object)); ++ g_clear_object (&priv->manager); + + G_OBJECT_CLASS (biji_item_parent_class)->finalize (object); + } +-- +cgit v0.12 + + +From 3853bc82c39e5331bc963f3664a679c23f6e3708 Mon Sep 17 00:00:00 2001 +From: Isaque Galdino +Date: Mon, 16 Apr 2018 17:51:23 -0300 +Subject: note-id: Fix memory leak + +--- + src/libbiji/biji-note-id.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/libbiji/biji-note-id.c b/src/libbiji/biji-note-id.c +index b056af6..f495c50 100644 +--- a/src/libbiji/biji-note-id.c ++++ b/src/libbiji/biji-note-id.c +@@ -35,7 +35,7 @@ struct _BijiNoteID + GObject parent_instance; + /* InfoSet */ + +- const gchar *path; ++ gchar *path; + gchar *title; + gchar *content; + gint64 mtime; +@@ -63,7 +63,9 @@ biji_note_id_finalize (GObject *object) + { + BijiNoteID *self = BIJI_NOTE_ID (object); + ++ g_free (self->path); + g_free (self->title); ++ g_free (self->content); + + G_OBJECT_CLASS (biji_note_id_parent_class)->finalize (object); + } +@@ -99,7 +101,7 @@ biji_note_id_set_property (GObject *object, + self->mtime = g_value_get_int64 (value); + break; + case PROP_CONTENT: +- self->content = g_strdup (g_value_get_string (value)); ++ biji_note_id_set_content (self, g_value_get_string (value)); + g_object_notify_by_pspec (object, properties[PROP_CONTENT]); + break; + default: +-- +cgit v0.12 + + +From 5a7f29ed5192ac02759bd8119f027ee14fbab65f Mon Sep 17 00:00:00 2001 +From: Isaque Galdino +Date: Mon, 16 Apr 2018 17:51:48 -0300 +Subject: provider: Fix memory leak + +--- + src/libbiji/provider/biji-provider.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/src/libbiji/provider/biji-provider.c b/src/libbiji/provider/biji-provider.c +index d351040..0b51e89 100644 +--- a/src/libbiji/provider/biji-provider.c ++++ b/src/libbiji/provider/biji-provider.c +@@ -111,11 +111,8 @@ biji_provider_load_archives (BijiProvider *provider) + static void + biji_provider_finalize (GObject *object) + { +- //BijiProvider *self; +- +- //g_return_if_fail (BIJI_IS_PROVIDER (object)); +- +- //self = BIJI_PROVIDER (object); ++ BijiProviderPrivate *priv = biji_provider_get_instance_private (BIJI_PROVIDER (object)); ++ g_clear_object (&priv->manager); + + G_OBJECT_CLASS (biji_provider_parent_class)->finalize (object); + } +-- +cgit v0.12 + diff --git a/bijiben-settings-dialog-Fix-settings.patch b/bijiben-settings-dialog-Fix-settings.patch new file mode 100644 index 0000000..0ec0c6a --- /dev/null +++ b/bijiben-settings-dialog-Fix-settings.patch @@ -0,0 +1,68 @@ +From c0d602c448e3a703e905f959e25d7be47468abe2 Mon Sep 17 00:00:00 2001 +From: Isaque Galdino +Date: Mon, 16 Apr 2018 23:15:24 -0300 +Subject: settings-dialog: Fix settings + +BjbSettingsDialog was using standard GSettings directly instead of +using our custom BjbSettings class, so settings changes done in the UI +was not been seen by BjbSettings. +--- + src/bjb-settings-dialog.c | 19 ++++--------------- + 1 file changed, 4 insertions(+), 15 deletions(-) + +diff --git a/src/bjb-settings-dialog.c b/src/bjb-settings-dialog.c +index 7aaa018..5e17430 100644 +--- a/src/bjb-settings-dialog.c ++++ b/src/bjb-settings-dialog.c +@@ -55,13 +55,11 @@ static void + on_font_selected (GtkFontButton *widget, + BjbSettingsDialog *self) + { +- BjbSettings *settings; + g_autofree gchar *font_name = NULL; + +- settings = self->settings; + font_name = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (widget)); + +- g_settings_set_string (G_SETTINGS (settings), "font", font_name); ++ g_object_set (self->settings, "font", font_name, NULL); + + } + +@@ -69,20 +67,13 @@ static void + on_color_set (GtkColorButton *button, + BjbSettingsDialog *self) + { +- BjbSettings *settings; + GdkRGBA color; +- gchar *color_str; +- +- settings = self->settings; ++ g_autofree gchar *color_str = NULL; + + gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color); + color_str = gdk_rgba_to_string (&color); + +- g_settings_set_string (G_SETTINGS (settings), +- "color", +- color_str); +- +- g_free (color_str); ++ g_object_set (self->settings, "color", color_str, NULL); + } + + /* Primary Provider page */ +@@ -209,9 +200,7 @@ on_row_activated_cb (GtkListBox *list_box, + if (child->selected == TRUE) + return; + +- g_object_set (bjb_app_get_settings (g_application_get_default ()), +- "default-location", child->id, NULL); +- ++ g_object_set (self->settings, "default-location", child->id, NULL); + + /* Toggle everything : unselect all but this one */ + g_list_foreach (self->children, unselect_child, NULL); +-- +cgit v0.12 + diff --git a/bijiben-webkit-editor_Use-g_auto.patch b/bijiben-webkit-editor_Use-g_auto.patch new file mode 100644 index 0000000..f4f76b6 --- /dev/null +++ b/bijiben-webkit-editor_Use-g_auto.patch @@ -0,0 +1,125 @@ +From 8fe5166af48375f4907cb5fef90cabbed7023780 Mon Sep 17 00:00:00 2001 +From: Mohammed Sadiq +Date: Tue, 17 Apr 2018 07:14:25 +0530 +Subject: webkit-editor: Use g_auto* + +https://bugzilla.gnome.org/show_bug.cgi?id=792221 +--- + src/libbiji/editor/biji-webkit-editor.c | 23 +++++++---------------- + 1 file changed, 7 insertions(+), 16 deletions(-) + +diff --git a/src/libbiji/editor/biji-webkit-editor.c b/src/libbiji/editor/biji-webkit-editor.c +index 3a4d4c2..f285ff8 100644 +--- a/src/libbiji/editor/biji-webkit-editor.c ++++ b/src/libbiji/editor/biji-webkit-editor.c +@@ -213,13 +213,12 @@ biji_webkit_editor_redo (BijiWebkitEditor *self) + static void + set_editor_color (WebKitWebView *w, GdkRGBA *col) + { +- gchar *script; ++ g_autofree gchar *script = NULL; + + webkit_web_view_set_background_color (w, col); + script = g_strdup_printf ("document.getElementById('editable').style.color = '%s';", + col->red < 0.5 ? "white" : "black"); + webkit_web_view_run_javascript (w, script, NULL, NULL, NULL); +- g_free (script); + } + + void +@@ -299,7 +298,7 @@ biji_webkit_editor_content_changed (BijiWebkitEditor *self, + if (rows && rows[0]) + { + gchar *title; +- gchar *unique_title; ++ g_autofree gchar *unique_title = NULL; + + title = rows[0]; + +@@ -309,7 +308,6 @@ biji_webkit_editor_content_changed (BijiWebkitEditor *self, + title); + + biji_note_obj_set_title (note, unique_title); +- g_free (unique_title); + } + } + +@@ -449,7 +447,8 @@ biji_webkit_editor_handle_contents_update (BijiWebkitEditor *self, + JSGlobalContextRef js_context, + JSObjectRef js_object) + { +- char *html, *text; ++ g_autofree gchar *html = NULL; ++ g_autofree gchar *text = NULL; + + html = get_js_property_string (js_context, js_object, "outerHTML"); + if (!html) +@@ -457,14 +456,9 @@ biji_webkit_editor_handle_contents_update (BijiWebkitEditor *self, + + text = get_js_property_string (js_context, js_object, "innerText"); + if (!text) +- { +- g_free (html); + return; +- } + + biji_webkit_editor_content_changed (self, html, text); +- g_free (html); +- g_free (text); + } + + static void +@@ -472,7 +466,7 @@ biji_webkit_editor_handle_selection_change (BijiWebkitEditor *self, + JSGlobalContextRef js_context, + JSObjectRef js_object) + { +- char *block_format_str; ++ g_autofree char *block_format_str = NULL; + + self->priv->has_text = get_js_property_boolean (js_context, js_object, "hasText"); + +@@ -486,7 +480,6 @@ biji_webkit_editor_handle_selection_change (BijiWebkitEditor *self, + self->priv->block_format = BLOCK_FORMAT_ORDERED_LIST; + else + self->priv->block_format = BLOCK_FORMAT_NONE; +- g_free (block_format_str); + } + + static void +@@ -497,7 +490,7 @@ on_script_message (WebKitUserContentManager *user_content, + JSGlobalContextRef js_context; + JSValueRef js_value; + JSObjectRef js_object; +- char *message_name; ++ g_autofree char *message_name = NULL; + + js_context = webkit_javascript_result_get_global_context (message); + js_value = webkit_javascript_result_get_value (message); +@@ -521,7 +514,6 @@ on_script_message (WebKitUserContentManager *user_content, + } + else if (g_strcmp0 (message_name, "SelectionChange") == 0) + biji_webkit_editor_handle_selection_change (self, js_context, js_object); +- g_free (message_name); + } + + static void +@@ -531,7 +523,7 @@ biji_webkit_editor_constructed (GObject *obj) + BijiWebkitEditorPrivate *priv; + WebKitWebView *view; + WebKitUserContentManager *user_content; +- GBytes *html_data; ++ g_autoptr(GBytes) html_data = NULL; + gchar *body; + + self = BIJI_WEBKIT_EDITOR (obj); +@@ -562,7 +554,6 @@ biji_webkit_editor_constructed (GObject *obj) + html_data = g_bytes_new_take (body, strlen (body)); + webkit_web_view_load_bytes (view, html_data, "application/xhtml+xml", NULL, + "file://" DATADIR G_DIR_SEPARATOR_S "bijiben" G_DIR_SEPARATOR_S); +- g_bytes_unref (html_data); + + /* Do not be a browser */ + g_signal_connect (view, "decide-policy", +-- +cgit v0.12 + diff --git a/bijiben.changes b/bijiben.changes index 0edabad..0ffbd73 100644 --- a/bijiben.changes +++ b/bijiben.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun Apr 22 21:22:57 UTC 2018 - bjorn.lie@gmail.com + +- Add upstream bug fix patches: + + bijiben-memory-leak-fixes.patch. + + bijiben-webkit-editor_Use-g_auto.patch (bgo#792221). + + bijiben-settings-dialog-Fix-settings.patch. + ------------------------------------------------------------------- Tue Apr 10 00:02:55 UTC 2018 - bjorn.lie@gmail.com diff --git a/bijiben.spec b/bijiben.spec index 3f85bc5..edf11cf 100644 --- a/bijiben.spec +++ b/bijiben.spec @@ -24,7 +24,13 @@ Summary: Note editor for GNOME License: GPL-3.0-or-later AND CC-BY-SA-3.0 Group: Productivity/Text/Editors URL: https://wiki.gnome.org/Apps/Bijiben -Source: http://download.gnome.org/sources/bijiben/3.28/%{name}-%{version}.tar.xz +Source0: https://download.gnome.org/sources/bijiben/3.28/%{name}-%{version}.tar.xz +# PATCH-FIX-UPSTREAM bijiben-memory-leak-fixes.patch bjorn.lie@gmail.com -- Fix various memory leaks +Patch0: bijiben-memory-leak-fixes.patch +# PATCH-FIX-UPSTREAM bijiben-webkit-editor_Use-g_auto.patch bgo#792221 bjorn.lie@gmail.com -- webkit-editor: Use g_auto* +Patch1: bijiben-webkit-editor_Use-g_auto.patch +# PATCH-FIX-UPSTREAM bijiben-settings-dialog-Fix-settings.patch bjorn.lie@gmail.com -- settings-dialog: Fix settings +Patch2: bijiben-settings-dialog-Fix-settings.patch BuildRequires: fdupes BuildRequires: gettext BuildRequires: meson @@ -67,7 +73,7 @@ search results from documents. %lang_package %prep -%setup -q +%autosetup -p1 %build %meson \