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 786531 - Crashes when deleting last picture of an event
Crashes when deleting last picture of an event
Status: RESOLVED FIXED
Product: shotwell
Classification: Other
Component: events
0.26.x
Other Linux
: Normal major
: ---
Assigned To: Shotwell Maintainers
Shotwell Maintainers
: 790541 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-08-19 23:57 UTC by akronix5
Modified: 2018-01-13 22:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Full backtrace (9.61 KB, text/plain)
2017-11-19 06:32 UTC, Marcin
  Details
crash when deleting last file in event (2.73 MB, text/x-log)
2018-01-13 19:24 UTC, Simon Claessen
  Details
Prevent crash when removing the event's last photo (1.32 KB, patch)
2018-01-13 22:08 UTC, Jens Georg
committed Details | Review

Description akronix5 2017-08-19 23:57:09 UTC
If I enter in an event, select and delete (move to Trash) all the pictures in there, shotwell hangs and then crashes. In particular, terminal output is:
21062 segmentation fault (core dumped)  shotwell

However, if I launch it with log (SHOTWELL_LOG=1 shotwell), it displays some failed assertions but it keeps working as expected. Exactly it says:

(shotwell:15007): Gtk-WARNING **: Allocating size to LibraryWindow 0x5581df6021f0 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?

(shotwell:15007): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'Page'
L 15007 2017-08-20 01:45:14 [CRT] page_get_view: assertion 'IS_PAGE (self)' failed
L 15007 2017-08-20 01:45:14 [CRT] data_collection_contains: assertion 'IS_DATA_COLLECTION (self)' failed

I'm on Ubuntu 17.04 and shotwell 0.26.3
Comment 1 Jens Georg 2017-08-20 04:44:06 UTC
I cannot reproduce this here. Please provide a backtrace as described in https://wiki.gnome.org/Apps/Shotwell/ReportingABug
Comment 2 Stefan 2017-08-22 21:24:22 UTC
I'm facing a similar issue. It can be reproduced by 2 ways. But you need the following pre-conditions:
* RAW Developer: Camera
* RAW+JPEG pair

First way (the easy one):
* Import 20 RAW+JPEG pairs from the camera and wait until the import is complete and the page "Last Import" is successfully loaded.
* Select a random (or all) photo on the last import page (do not navigate in the tree) and delete the selected items.
* Shotwell will crash (MediaViewTracker.vala:72:media_accumulator_real_uninclude: assertion failed: (photos > 0))

Second way (you need the right timing)
* Import 20 RAW+JPEG pairs from the camera and wait, until the import is complete and the page "Last Import" is successfully loaded.
* Navigate quickly to the event and delete all photos.
* Shotwell will crash (MediaViewTracker.vala:72:media_accumulator_real_uninclude: assertion failed: (photos > 0))

In my case, the problem seems to be the RAW development in the background. The MediaAccumulator counts 0 photos but 20 RAW after the include operations. 0 photos, because the RAW development has not finished.

When you remove the image, then, the raw development has finished and the uninclude method tries to remove a photo. But assert(photos > 0) is false.

But, is this the same issue? Should we open a new one?
Comment 3 Jens Georg 2017-08-23 03:03:11 UTC
(In reply to Stefan from comment #2)
> I'm facing a similar issue. It can be reproduced by 2 ways. But you need the
> following pre-conditions:
> * RAW Developer: Camera
> * RAW+JPEG pair
> 
> First way (the easy one):
> * Import 20 RAW+JPEG pairs from the camera and wait until the import is
> complete and the page "Last Import" is successfully loaded.
> * Select a random (or all) photo on the last import page (do not navigate in
> the tree) and delete the selected items.
> * Shotwell will crash
> (MediaViewTracker.vala:72:media_accumulator_real_uninclude: assertion
> failed: (photos > 0))
> 
> Second way (you need the right timing)
> * Import 20 RAW+JPEG pairs from the camera and wait, until the import is
> complete and the page "Last Import" is successfully loaded.
> * Navigate quickly to the event and delete all photos.
> * Shotwell will crash
> (MediaViewTracker.vala:72:media_accumulator_real_uninclude: assertion
> failed: (photos > 0))
> 
> In my case, the problem seems to be the RAW development in the background.
> The MediaAccumulator counts 0 photos but 20 RAW after the include
> operations. 0 photos, because the RAW development has not finished.
> 
> When you remove the image, then, the raw development has finished and the
> uninclude method tries to remove a photo. But assert(photos > 0) is false.
> 
> But, is this the same issue? Should we open a new one?

No, this is bug 719142
Comment 4 Jens Georg 2017-11-18 20:42:59 UTC
*** Bug 790541 has been marked as a duplicate of this bug. ***
Comment 5 Marcin 2017-11-19 06:32:40 UTC
Created attachment 363994 [details]
Full backtrace

Full backtrace for described problem
Comment 6 Jens Georg 2017-11-19 16:57:52 UTC
thanks
Comment 7 Simon Claessen 2018-01-13 19:04:54 UTC
just experienced this bug on ubuntu 16.04.1 on 64bit core 2 quad. shotwell stable 0.26.4 Aachen from ppa 

crashed several times before finding that deleting was the trigger.

reproduce:
1. browse a event.
2. start deleting pictures(pressing delete or right mouse>move to trash) 
3. after deleting last picture, shotwell chrashes after a short freeze (dark screen on ubuntu)
4. after restarting shotwell, the picture is still there, as on the hd
Comment 8 Simon Claessen 2018-01-13 19:24:26 UTC
Created attachment 366774 [details]
crash when deleting last file in event

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from shotwell...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/shotwell 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe7315700 (LWP 21092)]
[New Thread 0x7fffe6b14700 (LWP 21093)]
[New Thread 0x7fffe5a15700 (LWP 21094)]
[New Thread 0x7fffc8117700 (LWP 21095)]
L 21088 2018-01-13 20:09:54 [CRT] Plugins.vala:418: Not loading module /usr/lib/x86_64-linux-gnu/shotwell/plugins/builtin/shotwell-transitions.so (SPIT 0): module with name "org.yorba.shotwell.transitions" already loaded
L 21088 2018-01-13 20:09:54 [CRT] Plugins.vala:418: Not loading module /usr/lib/x86_64-linux-gnu/shotwell/plugins/builtin/shotwell-publishing.so (SPIT 0): module with name "org.yorba.shotwell.publishing.core_services" already loaded
L 21088 2018-01-13 20:09:54 [CRT] Plugins.vala:418: Not loading module /usr/lib/x86_64-linux-gnu/shotwell/plugins/builtin/shotwell-data-imports.la (SPIT 0): module with name "org.yorba.shotwell.data_imports.core_services" already loaded
L 21088 2018-01-13 20:09:54 [CRT] Plugins.vala:418: Not loading module /usr/lib/x86_64-linux-gnu/shotwell/plugins/builtin/shotwell-publishing-extras.so (SPIT 0): module with name "org.yorba.shotwell.publishing.extras" already loaded
[New Thread 0x7fffc6f5d700 (LWP 21096)]
[New Thread 0x7fffc675c700 (LWP 21097)]
[New Thread 0x7fffc5f5b700 (LWP 21098)]
[New Thread 0x7fffc575a700 (LWP 21099)]
[New Thread 0x7fffc45b6700 (LWP 21101)]
[New Thread 0x7fffc3db5700 (LWP 21102)]
[Thread 0x7fffc3db5700 (LWP 21102) exited]
[New Thread 0x7fffc3db5700 (LWP 21104)]
[Thread 0x7fffc3db5700 (LWP 21104) exited]
[New Thread 0x7fffc3db5700 (LWP 21105)]
[Thread 0x7fffc3db5700 (LWP 21105) exited]
[New Thread 0x7fffc3db5700 (LWP 21106)]
[New Thread 0x7fffc2483700 (LWP 21107)]
[New Thread 0x7fffc1a6a700 (LWP 21108)]
[New Thread 0x7fff95f8f700 (LWP 21109)]
[New Thread 0x7fff9578e700 (LWP 21110)]
[New Thread 0x7fff94f8d700 (LWP 21113)]
[Thread 0x7fffc2483700 (LWP 21107) exited]
[Thread 0x7fff94f8d700 (LWP 21113) exited]
[Thread 0x7fffc1a6a700 (LWP 21108) exited]
[Thread 0x7fffc45b6700 (LWP 21101) exited]
[Thread 0x7fffc3db5700 (LWP 21106) exited]
[Thread 0x7fff9578e700 (LWP 21110) exited]
L 21088 2018-01-13 20:15:09 [CRT] Directory (Last IFD item) with 5632 entries considered invalid; not read.

L 21088 2018-01-13 20:15:10 [CRT] Directory (Last IFD item) with 11961 entries considered invalid; not read.

L 21088 2018-01-13 20:15:11 [CRT] Directory (Last IFD item) with 28455 entries considered invalid; not read.

L 21088 2018-01-13 20:15:11 [CRT] Directory (Last IFD item) with 55900 entries considered invalid; not read.

L 21088 2018-01-13 20:15:12 [CRT] Directory (Last IFD item) with 54302 entries considered invalid; not read.

L 21088 2018-01-13 20:15:13 [CRT] Directory (Last IFD item) with 49510 entries considered invalid; not read.

L 21088 2018-01-13 20:15:14 [CRT] Directory (Last IFD item) with 59408 entries considered invalid; not read.

L 21088 2018-01-13 20:15:15 [CRT] Directory (Last IFD item) with 6462 entries considered invalid; not read.

L 21088 2018-01-13 20:15:15 [CRT] Directory (Last IFD item) with 33375 entries considered invalid; not read.

L 21088 2018-01-13 20:15:15 [CRT] Directory (Last IFD item) with 14581 entries considered invalid; not read.

L 21088 2018-01-13 20:15:16 [CRT] Directory (Last IFD item) with 20204 entries considered invalid; not read.

L 21088 2018-01-13 20:15:17 [CRT] Directory (Last IFD item) with 49051 entries considered invalid; not read.

L 21088 2018-01-13 20:15:18 [CRT] Directory (Last IFD item) with 40146 entries considered invalid; not read.

L 21088 2018-01-13 20:15:18 [CRT] Directory (Last IFD item) with 9069 entries considered invalid; not read.

L 21088 2018-01-13 20:15:19 [CRT] Directory (Last IFD item) with 49446 entries considered invalid; not read.

[New Thread 0x7fff9578e700 (LWP 21225)]
L 21088 2018-01-13 20:15:20 [CRT] PhotoMonitor.vala:1069: Unable to reimport [18963] /home/simon/Pictures/2012/01/2012_01_17/_MG_9444_CR2_shotwell.jpg due to master file changing: Unexpected early end-of-stream
L 21088 2018-01-13 20:15:20 [CRT] Directory (Last IFD item) with 61424 entries considered invalid; not read.

[Thread 0x7fff95f8f700 (LWP 21109) exited]
L 21088 2018-01-13 20:15:21 [CRT] Directory (Last IFD item) with 46848 entries considered invalid; not read.

L 21088 2018-01-13 20:15:22 [CRT] Directory (Last IFD item) with 21383 entries considered invalid; not read.

L 21088 2018-01-13 20:15:22 [CRT] Directory (Last IFD item) with 27387 entries considered invalid; not read.

L 21088 2018-01-13 20:15:22 [CRT] Directory (Last IFD item) with 35501 entries considered invalid; not read.

L 21088 2018-01-13 20:15:23 [CRT] Directory (Last IFD item) with 38645 entries considered invalid; not read.

L 21088 2018-01-13 20:15:23 [CRT] Directory (Last IFD item) with 62020 entries considered invalid; not read.

L 21088 2018-01-13 20:15:24 [CRT] PhotoMonitor.vala:1069: Unable to reimport [18964] /home/simon/Pictures/2012/01/2012_01_17/_MG_9445_CR2_shotwell.jpg due to master file changing: Unexpected early end-of-stream
[New Thread 0x7fff95f8f700 (LWP 21226)]
L 21088 2018-01-13 20:15:24 [CRT] Directory (Last IFD item) with 24620 entries considered invalid; not read.

L 21088 2018-01-13 20:15:24 [CRT] Directory (Last IFD item) with 39213 entries considered invalid; not read.

[Thread 0x7fff95f8f700 (LWP 21226) exited]
L 21088 2018-01-13 20:15:25 [CRT] Directory (Last IFD item) with 21155 entries considered invalid; not read.

L 21088 2018-01-13 20:15:25 [CRT] Directory (Last IFD item) with 29490 entries considered invalid; not read.

L 21088 2018-01-13 20:15:26 [CRT] Directory (Last IFD item) with 41579 entries considered invalid; not read.

L 21088 2018-01-13 20:15:26 [CRT] Directory (Last IFD item) with 5536 entries considered invalid; not read.

L 21088 2018-01-13 20:15:26 [CRT] Directory (Last IFD item) with 17834 entries considered invalid; not read.

L 21088 2018-01-13 20:15:27 [CRT] Directory (Last IFD item) with 36765 entries considered invalid; not read.

L 21088 2018-01-13 20:15:28 [CRT] Directory (Last IFD item) with 32141 entries considered invalid; not read.

L 21088 2018-01-13 20:15:28 [CRT] Directory (Last IFD item) with 23023 entries considered invalid; not read.

L 21088 2018-01-13 20:15:29 [CRT] Directory (Last IFD item) with 41219 entries considered invalid; not read.

L 21088 2018-01-13 20:15:31 [CRT] Directory (Last IFD item) with 65356 entries considered invalid; not read.

L 21088 2018-01-13 20:15:31 [CRT] Directory (Last IFD item) with 14175 entries considered invalid; not read.

L 21088 2018-01-13 20:15:32 [CRT] Directory (Last IFD item) with 32198 entries considered invalid; not read.

L 21088 2018-01-13 20:15:33 [CRT] Directory (Last IFD item) with 12742 entries considered invalid; not read.

L 21088 2018-01-13 20:15:34 [CRT] Directory (Last IFD item) with 23199 entries considered invalid; not read.

L 21088 2018-01-13 20:15:34 [CRT] Directory (Last IFD item) with 11179 entries considered invalid; not read.

L 21088 2018-01-13 20:15:35 [CRT] Directory (Last IFD item) with 5593 entries considered invalid; not read.

L 21088 2018-01-13 20:15:35 [CRT] Directory (Last IFD item) with 65081 entries considered invalid; not read.

L 21088 2018-01-13 20:15:35 [CRT] Directory (Last IFD item) with 31364 entries considered invalid; not read.

L 21088 2018-01-13 20:15:36 [CRT] Directory (Last IFD item) with 34180 entries considered invalid; not read.

L 21088 2018-01-13 20:15:37 [CRT] Directory (Last IFD item) with 57523 entries considered invalid; not read.

L 21088 2018-01-13 20:15:37 [CRT] Directory (Last IFD item) with 28784 entries considered invalid; not read.

L 21088 2018-01-13 20:15:38 [CRT] Directory (Last IFD item) with 20894 entries considered invalid; not read.

L 21088 2018-01-13 20:15:39 [CRT] Directory (Last IFD item) with 34894 entries considered invalid; not read.

L 21088 2018-01-13 20:15:39 [CRT] Directory (Last IFD item) with 51789 entries considered invalid; not read.

L 21088 2018-01-13 20:15:40 [CRT] Directory (Last IFD item) with 4829 entries considered invalid; not read.

L 21088 2018-01-13 20:15:40 [CRT] Directory (Last IFD item) with 1268 entries considered invalid; not read.

L 21088 2018-01-13 20:15:40 [CRT] Directory (Last IFD item) with 21534 entries considered invalid; not read.

L 21088 2018-01-13 20:15:41 [CRT] Directory (Last IFD item) with 26426 entries considered invalid; not read.

[New Thread 0x7fff95f8f700 (LWP 21231)]
[New Thread 0x7fffc3db5700 (LWP 21232)]
[New Thread 0x7fffc45b6700 (LWP 21233)]
[New Thread 0x7fff94f8d700 (LWP 21234)]
[Thread 0x7fff95f8f700 (LWP 21231) exited]
[Thread 0x7fff9578e700 (LWP 21225) exited]
[Thread 0x7fffc3db5700 (LWP 21232) exited]
[Thread 0x7fff94f8d700 (LWP 21234) exited]
[Thread 0x7fffc45b6700 (LWP 21233) exited]

Thread 1 "shotwell" received signal SIGSEGV, Segmentation fault.
g_type_check_instance_cast (type_instance=0x7cb7a80, iface_type=102204784)
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gtype.c:4065
4065	/build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gtype.c: No such file or directory.
(gdb) quit
A debugging session is active.

	Inferior 1 [process 21088] will be killed.

Quit anyway? (y or n) n
Not confirmed.
(gdb) backtrace full
Python Exception <class 'gdb.error'> Attempt to dereference a generic pointer.: 
  • #0 g_type_check_instance_cast
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gtype.c line 4065
  • #1 0x000000000067bd6e in
  • #5 <emit signal ??? on instance 0x65cc720 [GSimpleAction]>
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gsignal.c line 3441
  • #6 g_simple_action_activate
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gio/gsimpleaction.c line 225
  • #7 gtk_action_muxer_activate_action
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkactionmuxer.c line 412
  • #8 gtk_action_muxer_activate_action
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkactionmuxer.c line 414
  • #9 gtk_action_muxer_activate_action
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkactionmuxer.c line 414
  • #10 gtk_action_muxer_activate_action
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkactionmuxer.c line 414
  • #11 gtk_action_muxer_activate_action
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkactionmuxer.c line 414
  • #12 gtk_action_muxer_activate_action
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkactionmuxer.c line 414
  • #13 gtk_action_muxer_activate_action
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkactionmuxer.c line 414
  • #14 gtk_menu_tracker_item_activated
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmenutrackeritem.c line 804
  • #18 <emit signal ??? on instance 0x9eb26e0 [GtkModelMenuItem]>
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gsignal.c line 3441
  • #19 gtk_widget_activate
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkwidget.c line 7725
  • #20 gtk_menu_shell_activate_item
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmenushell.c line 1378
  • #21 gtk_menu_shell_button_release
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmenushell.c line 790
  • #22 _gtk_marshal_BOOLEAN__BOXEDv
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmarshalers.c line 131
  • #23 _g_closure_invoke_va
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gclosure.c line 867
  • #24 g_signal_emit_valist
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gsignal.c line 3294
  • #25 g_signal_emit
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gobject/gsignal.c line 3441
  • #26 gtk_widget_event_internal
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkwidget.c line 7692
  • #27 propagate_event
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmain.c line 2527
  • #28 propagate_event
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmain.c line 2629
  • #29 gtk_main_do_event
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmain.c line 1850
  • #30 gdk_event_source_dispatch
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gdk/x11/gdkeventsource.c line 369
  • #31 g_main_context_dispatch
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./glib/gmain.c line 3154
  • #32 g_main_context_dispatch
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./glib/gmain.c line 3769
  • #33 g_main_context_iterate
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./glib/gmain.c line 3840
  • #34 g_main_context_iteration
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./glib/gmain.c line 3901
  • #35 g_application_run
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./gio/gapplication.c line 2381
  • #36 application_start
  • #37 library_exec
  • #38 _vala_main
  • #39 main
A debugging session is active.

	Inferior 1 [process 21088] will be killed.

Quit anyway? (y or n) y
Comment 9 Simon Claessen 2018-01-13 20:24:01 UTC
additional note: when pressing delete, no files are moved to the trash. be it one of several or the last one. should this be posted as a separate bug?
Comment 10 Jens Georg 2018-01-13 21:03:31 UTC
That should work. Do you have some log output? There should be a critical on the console.
Comment 11 Jens Georg 2018-01-13 21:58:38 UTC
==980==ERROR: AddressSanitizer: heap-use-after-free on address 0x61a00090a0b0 at pc 0x7f703a67d2df bp 0x7ffcf17426b0 sp 0x7ffcf17426a0
READ of size 8 at 0x61a00090a0b0 thread T0
    #0 0x7f703a67d2de in g_type_check_instance_cast /home/jens/jhbuild/checkout/glib/gobject/gtype.c:4052
    #1 0x56196bde0816 in media_page_real_on_move_to_trash /home/jens/Source/shotwell/src/MediaPage.vala:783
    #2 0x7f703a6319b7 in g_cclosure_marshal_VOID__VARIANT /home/jens/jhbuild/checkout/glib/gobject/gmarshal.c:2140
    #3 0x7f703a62541c in g_closure_invoke /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:804
    #4 0x7f703a668524 in signal_emit_unlocked_R /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3635
    #5 0x7f703a6663d1 in g_signal_emit_valist /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3391
    #6 0x7f703a6671d2 in g_signal_emit /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3447
    #7 0x7f703aafffe0 in g_simple_action_activate /home/jens/jhbuild/checkout/glib/gio/gsimpleaction.c:225
    #8 0x7f703aafd077 in g_action_activate /home/jens/jhbuild/checkout/glib/gio/gaction.c:397
    #9 0x7f703aaf59f4 in g_simple_action_group_activate /home/jens/jhbuild/checkout/glib/gio/gsimpleactiongroup.c:138
    #10 0x7f703aaf3fd5 in g_action_group_activate_action /home/jens/jhbuild/checkout/glib/gio/gactiongroup.c:595
    #11 0x7f703935e9cf  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0xf79cf)
    #12 0x7f703aaf3fd5 in g_action_group_activate_action /home/jens/jhbuild/checkout/glib/gio/gactiongroup.c:595
    #13 0x7f703935e9a1  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0xf79a1)
    #14 0x7f703aaf3fd5 in g_action_group_activate_action /home/jens/jhbuild/checkout/glib/gio/gactiongroup.c:595
    #15 0x7f703935e9a1  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0xf79a1)
    #16 0x7f703aaf3fd5 in g_action_group_activate_action /home/jens/jhbuild/checkout/glib/gio/gactiongroup.c:595
    #17 0x7f703935e9a1  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0xf79a1)
    #18 0x7f703aaf3fd5 in g_action_group_activate_action /home/jens/jhbuild/checkout/glib/gio/gactiongroup.c:595
    #19 0x7f70393787dc  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1117dc)
    #20 0x7f70396099e8 in gtk_window_activate_key (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x3a29e8)
    #21 0x7f7039609bb0  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x3a2bb0)
    #22 0x56196bbcc6bd in page_window_real_key_press_event /home/jens/Source/shotwell/src/AppWindow.vala:331
    #23 0x56196ba93122 in library_window_real_key_press_event /home/jens/Source/shotwell/src/library/LibraryWindow.vala:1449
    #24 0x7f703949a5a6  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x2335a6)
    #25 0x7f703a62664e in g_type_class_meta_marshalv /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:1024
    #26 0x7f703a625c30 in _g_closure_invoke_va /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:867
    #27 0x7f703a66450b in g_signal_emit_valist /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3300
    #28 0x7f703a6671d2 in g_signal_emit /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3447
    #29 0x7f70395e5173  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x37e173)
    #30 0x7f703949750e  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x23050e)
    #31 0x7f70394995b7 in gtk_main_do_event (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x2325b7)
    #32 0x7f7038f979a4  (/usr/lib/x86_64-linux-gnu/libgdk-3.so.0+0x3b9a4)
    #33 0x7f7038ff44d1  (/usr/lib/x86_64-linux-gnu/libgdk-3.so.0+0x984d1)
    #34 0x7f703a233642 in g_main_dispatch /home/jens/jhbuild/checkout/glib/glib/gmain.c:3200
    #35 0x7f703a236a3d in g_main_context_dispatch /home/jens/jhbuild/checkout/glib/glib/gmain.c:3853
    #36 0x7f703a236fd0 in g_main_context_iterate /home/jens/jhbuild/checkout/glib/glib/gmain.c:3926
    #37 0x7f703a237106 in g_main_context_iteration /home/jens/jhbuild/checkout/glib/glib/gmain.c:3987
    #38 0x7f703aae8e99 in g_application_run /home/jens/jhbuild/checkout/glib/gio/gapplication.c:2482
    #39 0x56196bdd8d34 in application_start /home/jens/Source/shotwell/src/Application.vala:182
    #40 0x56196bbc621c in library_exec /home/jens/Source/shotwell/src/main.vala:198
    #41 0x56196bbc857d in _vala_main /home/jens/Source/shotwell/src/main.vala:441
    #42 0x56196b9a072f in main /home/jens/Source/shotwell/src/main.vala:330
    #43 0x7f70367551c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)
    #44 0x56196b9a11f9 in _start (/home/jens/Source/shotwell/build/src/shotwell+0x2241f9)

0x61a00090a0b0 is located 1072 bytes inside of 1208-byte region [0x61a000909c80,0x61a00090a138)
freed by thread T0 here:
    #0 0x7f703b2fd7b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
    #1 0x7f703a24858e in g_free /home/jens/jhbuild/checkout/glib/glib/gmem.c:189
    #2 0x7f703a283b0d in g_slice_free1 /home/jens/jhbuild/checkout/glib/glib/gslice.c:1136
    #3 0x7f703a674dff in g_type_free_instance /home/jens/jhbuild/checkout/glib/gobject/gtype.c:1943
    #4 0x7f703a64140b in g_object_unref /home/jens/jhbuild/checkout/glib/gobject/gobject.c:3349
    #5 0x56196bb17e2f in sidebar_simple_page_entry_real_pruned /home/jens/Source/shotwell/src/sidebar/common.vala:94
    #6 0x56196bb148f1 in sidebar_tree_disassociate_wrapper /home/jens/Source/shotwell/src/sidebar/Tree.vala:591
    #7 0x56196bb153f6 in sidebar_tree_disassociate_wrapper_and_signal /home/jens/Source/shotwell/src/sidebar/Tree.vala:553
    #8 0x56196bb1573a in sidebar_tree_on_branch_entry_removed /home/jens/Source/shotwell/src/sidebar/Tree.vala:645
    #9 0x56196bb1573a in _sidebar_tree_on_branch_entry_removed_sidebar_branch_entry_removed /home/jens/Source/shotwell/src/sidebar/Tree.vala:410
    #10 0x7f703a6314ba in g_cclosure_marshal_VOID__OBJECT /home/jens/jhbuild/checkout/glib/gobject/gmarshal.c:2062
    #11 0x7f703a62541c in g_closure_invoke /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:804
    #12 0x7f703a668524 in signal_emit_unlocked_R /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3635
    #13 0x7f703a6663d1 in g_signal_emit_valist /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3391
    #14 0x7f703a6671d2 in g_signal_emit /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3447
    #15 0x56196bafc2fc in sidebar_branch_prune /home/jens/Source/shotwell/src/sidebar/Branch.vala:280
    #16 0x56196bb1f027 in events_branch_remove_event /home/jens/Source/shotwell/src/events/EventsBranch.vala:286
    #17 0x56196bb1f027 in events_branch_on_events_added_removed /home/jens/Source/shotwell/src/events/EventsBranch.vala:190
    #18 0x56196bb1f027 in _events_branch_on_events_added_removed_data_collection_contents_altered /home/jens/Source/shotwell/src/events/EventsBranch.vala:47
    #19 0x7f703a62541c in g_closure_invoke /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:804
    #20 0x7f703a668524 in signal_emit_unlocked_R /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3635
    #21 0x7f703a6663d1 in g_signal_emit_valist /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3391
    #22 0x7f703a6671d2 in g_signal_emit /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3447
    #23 0x56196babada9 in data_collection_real_remove_marked /home/jens/Source/shotwell/src/core/DataCollection.vala:451
    #24 0x56196bac5ffa in source_collection_unlink_marked /home/jens/Source/shotwell/src/core/SourceCollection.vala:170
    #25 0x56196bace1ab in container_source_collection_evaporate /home/jens/Source/shotwell/src/core/ContainerSourceCollection.vala:203
    #26 0x56196bd196a6 in event_on_media_removed /home/jens/Source/shotwell/src/Event.vala:406
    #27 0x56196bd196a6 in _event_on_media_removed_data_collection_items_removed /home/jens/Source/shotwell/src/Event.vala:241
    #28 0x7f703a6314ba in g_cclosure_marshal_VOID__OBJECT /home/jens/jhbuild/checkout/glib/gobject/gmarshal.c:2062
    #29 0x7f703a62541c in g_closure_invoke /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:804
    #30 0x7f703a668524 in signal_emit_unlocked_R /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3635
    #31 0x7f703a6663d1 in g_signal_emit_valist /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3391
    #32 0x7f703a6671d2 in g_signal_emit /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3447
    #33 0x56196babad83 in data_collection_real_remove_marked /home/jens/Source/shotwell/src/core/DataCollection.vala:450

previously allocated by thread T0 here:
    #0 0x7f703b2fdb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7f703a24843f in g_malloc /home/jens/jhbuild/checkout/glib/glib/gmem.c:94
    #2 0x7f703a28381b in g_slice_alloc /home/jens/jhbuild/checkout/glib/glib/gslice.c:1025
    #3 0x7f703a28385a in g_slice_alloc0 /home/jens/jhbuild/checkout/glib/glib/gslice.c:1051
    #4 0x7f703a673e8e in g_type_create_instance /home/jens/jhbuild/checkout/glib/gobject/gtype.c:1848
    #5 0x7f703a63993e in g_object_new_internal /home/jens/jhbuild/checkout/glib/gobject/gobject.c:1797
    #6 0x7f703a63a2f5 in g_object_new_with_properties /home/jens/jhbuild/checkout/glib/gobject/gobject.c:1965
    #7 0x7f703a6391bf in g_object_new /home/jens/jhbuild/checkout/glib/gobject/gobject.c:1637
    #8 0x56196bc3e3b5 in page_construct /home/jens/Source/shotwell/src/Page.vala:89
    #9 0x56196bc4d541 in checkerboard_page_construct /home/jens/Source/shotwell/src/Page.vala:1250
    #10 0x56196bde6c42 in media_page_construct /home/jens/Source/shotwell/src/MediaPage.vala:248
    #11 0x56196bbd49aa in collection_page_construct /home/jens/Source/shotwell/src/CollectionPage.vala:33
    #12 0x56196bb25283 in event_page_construct /home/jens/Source/shotwell/src/events/EventPage.vala:11
    #13 0x56196bb1fc5b in events_event_entry_real_create_page /home/jens/Source/shotwell/src/events/EventsBranch.vala:487
    #14 0x56196bb17f67 in sidebar_simple_page_entry_real_get_page /home/jens/Source/shotwell/src/sidebar/common.vala:81
    #15 0x56196ba8cdff in library_window_on_sidebar_entry_selected /home/jens/Source/shotwell/src/library/LibraryWindow.vala:1342
    #16 0x56196ba8cdff in _library_window_on_sidebar_entry_selected_sidebar_tree_entry_selected /home/jens/Source/shotwell/src/library/LibraryWindow.vala:225
    #17 0x7f703a6314ba in g_cclosure_marshal_VOID__OBJECT /home/jens/jhbuild/checkout/glib/gobject/gmarshal.c:2062
    #18 0x7f703a62541c in g_closure_invoke /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:804
    #19 0x7f703a668524 in signal_emit_unlocked_R /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3635
    #20 0x7f703a6663d1 in g_signal_emit_valist /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3391
    #21 0x7f703a6671d2 in g_signal_emit /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3447
    #22 0x56196bb13d70 in sidebar_tree_real_cursor_changed /home/jens/Source/shotwell/src/sidebar/Tree.vala:329
    #23 0x7f703a62c8ea in g_cclosure_marshal_VOID__VOIDv /home/jens/jhbuild/checkout/glib/gobject/gmarshal.c:905
    #24 0x7f703a62664e in g_type_class_meta_marshalv /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:1024
    #25 0x7f703a625c30 in _g_closure_invoke_va /home/jens/jhbuild/checkout/glib/gobject/gclosure.c:867
    #26 0x7f703a66450b in g_signal_emit_valist /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3300
    #27 0x7f703a6671d2 in g_signal_emit /home/jens/jhbuild/checkout/glib/gobject/gsignal.c:3447
    #28 0x7f70395cb807  (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x364807)

SUMMARY: AddressSanitizer: heap-use-after-free /home/jens/jhbuild/checkout/glib/gobject/gtype.c:4052 in g_type_check_instance_cast
Shadow bytes around the buggy address:
Comment 12 Jens Georg 2018-01-13 22:08:35 UTC
Created attachment 366780 [details] [review]
Prevent crash when removing the event's last photo

Issue is that this would destroy the event and destroy the media page,
afterwards trying to update the undo list on the now destroyed view
Comment 13 Jens Georg 2018-01-13 22:10:14 UTC
Attachment 366780 [details] pushed as d076d4c - Prevent crash when removing the event's last photo