Launching a second instance of Shutter if one instance is already open causes a crash

Bug #731874 reported by Photon on 2011-03-09
This bug affects 11 people
Affects Status Importance Assigned to Milestone
Mario Kemper (Romario)

Bug Description

When Shutter is already open the use of Print or Alt+Print crashes it with following output:


If using the shortcuts when Shutter isn't open everything works fine.

Rev. 1064 on Arch Linux

Full output attached.

Photon (michael-kogan) wrote :
description: updated

This does not happen when running Ubuntu, but I have seen those crashes during development. Could you please try different capture modes and check if Shutter crashes in all cases? See 'man shutter' for all available capture modes.

Seems to appear with all modes (selecting different modes in Preferences>Keyboard and then trying Alt+Print).

summary: - Using PrintScreen when Shuter is already open causes a crash
+ Using PrintScreen when Shutter is already open causes a crash
Photon (michael-kogan) wrote :

Using libunique 1.1.6 and perl-gtk2-unique 0.05.

Changed in shutter:
assignee: nobody → Mario Kemper (Romario) (mario-kemper)
importance: Undecided → Low
milestone: none → 0.88.x
status: New → Confirmed
Photon (michael-kogan) wrote :

I thought, you might be interested in the output of the new instance launched with another instance being open, the relevant lines are

WARNING **: Error while sending message: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus) at /usr/bin/shutter line 320, <DATA> line 19.

INFO: There is already another instance of Shutter running!

Also, the problem is not related to the PrintScreen shortcut, it appears also when both instances are launched from the terminal via "/usr/bin/shutter --full".

summary: - Using PrintScreen when Shutter is already open causes a crash
+ Launching a second instance of Shutter if one instance is already open
+ causes a crash
tags: added: instances
removed: shortkeys
bericp1 (bericp1) wrote :

Affects me too on Arch, all packages related to shutter up to date. Any other way to bind shortcut keys without running the shutter command again?

Changed in shutter:
milestone: upload → capture
patryk (pbratkowski) wrote :

Also have that problem running aur/shutter 0.90.1-1 and aur/shutter-bzr 1253-2

Using the bzr revision, if I change line 333 from
$app->send_message( $cmdid, text => '' );
$app->send_message( $cmdid, text => 'a' );

it no longer crashes when running shutter --full in another window. It appears that $message->get_text causes the segfault when text is set to an empty string.

It still crashes when using shutter --window, because on line 330, $extra is defined, but set to ''.

Sorry, I won't debug the whole thing but this should get you started in the right direction.

Sparhawk (sparhawkthesecond) wrote :

I see this bug too, but I just wanted to mention that if I start the first Shutter instance up in a terminal, it tells me that there was a "Segmentation fault (core dumped)". I'm not really sure where to find this dump though. I'm happy to debug more if you can tell me where to look.

Sparhawk (sparhawkthesecond) wrote :

Shutter has been accepted into the official Arch repos, and I've created a bug report on the Arch tracker. Please add any useful information and vote there.

Changed in shutter:
importance: Low → Medium
milestone: capture → 0.92
status: Confirmed → Fix Committed
Changed in shutter:
status: Fix Committed → Fix Released
Sparhawk (sparhawkthesecond) wrote :

I can confirm that this bug is fixed in Arch Linux. Thanks for sorting that out. Cheers.

Sparhawk (sparhawkthesecond) wrote :

Correction: this is fixed for new instances launched with `shutter --full`, but shutter still crashes if the new instance is launched with `shutter --select` or `shutter --window`. (This has been confirmed here: )

Photon (michael-kogan) wrote :

I can also confirm the fix to be only partial. Also, running Shutter without any options leads to a crash.

Changed in shutter:
status: Fix Released → In Progress
Changed in shutter:
milestone: 0.92 → misc
Aleksej (aleksejrs) wrote :

Started happening to me recently (days to months) on Debian testing with Shutter 0.93.1 Rev.1278. No switches, --select, --section, or --full.

I don't know Perl nor GTK2 but I have fixed it for myself. The problem is that for some reason GTK2 is unable to parse received message containing an empty string which leads to segmentation fault. The ugly but working solution is to send a message with some unique text which should be replaced again to empty string after the message has been received, to simulate the same behaviour.

Sparhawk (sparhawkthesecond) wrote :

Thank you Wojciech! I can confirm that this patch fixes the bug on my system. I tested both `shutter --select` and `shutter --window`, and shutter no longer segfaults. Thanks for the fix!

Photon (michael-kogan) wrote :

Ii also confirm the fix and included it into Arch's Shutter package.

@michael-kogan you may also want to check out this:

This is also a fix for the same issue, but a cleaner one, IMO.

Photon (michael-kogan) wrote :

Cool, I will have a look asap! In the mean time: I was thinking of creating a fork implementing all the patches currently available here on Launchpad. The only problem is that I don't even know Perl, so I wouldn't be able to review them. Maybe you are interested in applying the patches in your forked repo? I collected most of them in Shutter's AUR package:

Photon (michael-kogan) wrote :

Tested it now (and included into the package), it works flawlessly, now there are no crashes even if you launch the second instance without any options. Thanks for the patch!

Photon (michael-kogan) wrote :

Applied patch fixing this in rev.1284.

Changed in shutter:
status: In Progress → Fix Committed
Photon (michael-kogan) on 2017-08-14
Changed in shutter:
milestone: misc → 0.94
Photon (michael-kogan) on 2017-08-16
Changed in shutter:
status: Fix Committed → Fix Released
chapeaurouge (fred-blaise) wrote :

It looks like this is the issue I am running into (on opensuse), yet I am running 0.94 r1290. Reading all the above, I'd have assumed the fix was made upstream? Thanks.

shutter -s
WARNING: gnome-web-photo is missing --> screenshots of websites will be disabled!

(shutter:14314): Unique-DBus-WARNING **: Error while sending message: Message recipient disconnected from message bus without replying

INFO: There is already another instance of Shutter running!
[and it crashes the 1st instance]

Photon (michael-kogan) wrote :

Yep, it is borked again, but reverting the patch which initially fixed it doesn't help either. Seems like a new problem with old symptoms.

Neil Hanlon (hanlon-neil) wrote :

Seeing this still with `0.93.1 Rev.1278` on debian stable (stretch)

jnko (joern-koerner) wrote :

I did a little bit debugging in the last 15 minutes and found the cause of this crash.
(Shutter 0.94, Rev 1290 running on Archlinux)

Shutter crashes when starting a second instance at line 345

 $app->send_message( 11, uris => \@escaped_filenames );

Simply comment this and it won't crash anymore. I didn't dive into the code yet but reading shutter command line help and that part of the code I just don't see what 'uris' should be passed to shutter at this point. But this is surely related to me since I'm not a perl monk at all.

        #escape all filenames, see Bug #737428
        my @escaped_filenames;
        foreach my $file (@init_files) {
            push @escaped_filenames, Gnome2::VFS->escape_string($file);
        #$app->send_message( 11, uris => \@escaped_filenames );

    print "\nINFO: There is already another instance of Shutter running!\n";

    #Create the single application instance and wait for other requests

jnko (joern-koerner) wrote :

Well the above "patch" was too early, sorry.
Shutter crashes every time $app->send_message() is being called and it will be called with different $cmdid for each argument passed to it.

Also I checked this against a Debian install and surprise: No problems at all.

Seems like the root cause is somewhere else. Anyway I'll try to investigate further

Photon (michael-kogan) wrote :

Could it be due to an older Perl version in Debian?

Changed in shutter:
status: Fix Released → Confirmed
Photon (michael-kogan) wrote :

A user in the AUR reported that he investigated this issue further and suspects the source of error to be in the C code somewhere in the libraries used by Shutter, most probably in libunique or perl-gtk2-unique. See here for the original comment:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers