After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 785975 - When closing annotation windows, Evince runs into a busy loop
When closing annotation windows, Evince runs into a busy loop
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: pdf annotations
3.22.x
Other Linux
: Normal critical
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-07 23:07 UTC by Christian Stadelmann
Modified: 2017-09-30 07:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A full backtrace from gdb attached to evince (24.96 KB, text/plain)
2017-08-07 23:07 UTC, Christian Stadelmann
  Details
view: Fix infinite loop over annotation windows (1.02 KB, patch)
2017-08-09 01:50 UTC, José Aliste
committed Details | Review

Description Christian Stadelmann 2017-08-07 23:07:26 UTC
Created attachment 357162 [details]
A full backtrace from gdb attached to evince

Steps to reproduce:
unclear. Something about removing annotation windows. Maybe related to https://bugzilla.gnome.org/show_bug.cgi?id=782758.

What happens:
Exaile does not react to user input any more. It runs into a busy loop.

After attaching gdb to evince, I get this backtrace (full backtrace attached):

  • #0 ev_view_remove_window_child_for_annot
    at ev-view.c line 3020
  • #1 ev_view_remove_annotation
    at ev-view.c line 3471
  • #5 <emit signal ??? on instance 0x432d4b0680 [GSimpleAction]>
    at gsignal.c line 3447
  • #6 g_simple_action_activate
    at gsimpleaction.c line 225
  • #7 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 412
  • #8 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #9 gtk_menu_tracker_item_activated
    at gtkmenutrackeritem.c line 799

Additional info:
I think I know why this bug happens and when it has been introduced:
In ev_view_remove_window_child_for_annot (https://git.gnome.org/browse/evince/tree/libview/ev-view.c?h=gnome-3-24#n3007), the while loop will never be left if there is any window with "child->page != page", because the "continue" statement happens before any change to the loop variable "children" is done. This bug has been introduced in https://git.gnome.org/browse/evince/commit/libview/ev-view.c?id=d4b76d5ca904d5dc28d3f96d35fbb63e9d5c2874 when trying to fix https://bugzilla.gnome.org/show_bug.cgi?id=760299.
Comment 1 José Aliste 2017-08-08 12:36:51 UTC
thanks for the bug. I will look into it asap
Comment 2 José Aliste 2017-08-08 12:51:50 UTC
oh... I see you are right... How silly of me :( Care to propose a patch?
Comment 3 José Aliste 2017-08-09 01:50:05 UTC
Created attachment 357221 [details] [review]
view: Fix infinite loop over annotation windows

When fixing bug 760299, we introduced an infinite loop
that is triggered (sometimes) when removing annotations.
This patch fixes that.
Comment 4 José Aliste 2017-08-09 01:52:44 UTC
This should fix the infinite loop by ensuring we iterate over the list before continuing... Carlos, I opted for this instead of adding a new variable to hold the old pointer of children (which is needed to delete). The other way would be to just put the delete code inside an if clause and remove the continue.
Comment 5 Christian Stadelmann 2017-08-09 08:53:14 UTC
(In reply to José Aliste from comment #2)
> oh... I see you are right... How silly of me :( Care to propose a patch?

It would take me a while, but you were faster ;)

Your patch looks good to me.
Comment 6 Carlos Garcia Campos 2017-08-19 06:39:17 UTC
Comment on attachment 357221 [details] [review]
view: Fix infinite loop over annotation windows

Thanks!
Comment 7 Christian Stadelmann 2017-08-19 09:18:20 UTC
Will there be a 3.24.1 release, with this patch applied? The next stable release, 3.26.0, is expected to be released in ~4 weeks and it will take some more time to get it into downstream distros.
Comment 8 Christian Stadelmann 2017-08-19 12:31:16 UTC
(In reply to Christian Stadelmann from comment #7)
> Will there be a 3.24.1 release, with this patch applied?

I meant 3.24.2, of course, not 3.24.1, which has been released 4 weeks ago.
Comment 9 José Aliste 2017-09-28 22:41:33 UTC
I just pushed the patch to the 3.24 branch.

Carlos, can you make the release? Or should we include other fixes into it?
Comment 10 Carlos Garcia Campos 2017-09-30 07:33:02 UTC
(In reply to José Aliste from comment #9)
> I just pushed the patch to the 3.24 branch.
> 
> Carlos, can you make the release? Or should we include other fixes into it?

Done