[evince] libview: Do not create annotation window twice.
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] libview: Do not create annotation window twice.
- Date: Fri, 9 Sep 2016 13:54:45 +0000 (UTC)
commit 932b22ba7f9f793e81399ae3992dcae1dd0f876c
Author: Jose Aliste <jaliste src gnome org>
Date: Tue Jul 26 13:57:25 2016 -0300
libview: Do not create annotation window twice.
Currently, in button_release_event we always create the annotation window. Since
there is a chance that draw event will show the annotation windows (and in that
case creates annotation windows if they don't exist) then the annotation window
will be created twice. This causes a leak because we only destroy one of these windows...
and also when removing annotations with the window open we don't destroy the window
(we destroy a window which is already hidden).
The solution here is to check in button_release wether a window has been already created
for the annotation, and only if not, create the new annotation window.
https://bugzilla.gnome.org/show_bug.cgi?id=769200
libview/ev-view.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 9f0c866..bec6a85 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -5725,9 +5725,13 @@ ev_view_button_release_event (GtkWidget *widget,
EV_ANNOTATIONS_SAVE_POPUP_RECT);
ev_document_doc_mutex_unlock ();
}
+ /* the annotation window might already exist */
+ window = get_window_for_annot (view, view->adding_annot_info.annot);
- parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
- window = ev_view_create_annotation_window (view,
view->adding_annot_info.annot, parent);
+ if (window == NULL) {
+ parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
+ window = ev_view_create_annotation_window (view,
view->adding_annot_info.annot, parent);
+ }
/* Show the annot window the first time for text annotations */
if (view->adding_annot_info.type == EV_ANNOTATION_TYPE_TEXT)
ev_view_annotation_show_popup_window (view, window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]