#715 Unpredictable number of instances

v1.23
closed
nobody
None
5
2014-04-20
2014-03-18
No

Hi!

When I highlight several files in Nautilus, and select "Open with geany" from the right-click context menu, the resulting number of Geany instances seem quite random. When opening four files, I will sometimes get three Geany windows, where one of them has two tabs, sometimes two Geany windows, where one has three tabs, and sometimes four Geany windows with one file in each.

My Geany is compiled with support for sockets. In one case when I opened four files and ended up with three Geany windows, I had two socket files in /tmp:

/tmp/geany_socket.7331e84f
/tmp/geany_socket.7331e84f

in addition to one symlink

~/.config/geany/geany_socket_enlil.uio.no__0 -> /tmp/geany_socket.fb528abf

At the same time, the "ps" command shows three running instances of Geany.

The content of ~/.local/share/applications/userapp-geany-U630HW.desktop is:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=geany %f
Name=geany
Comment=Custom definition for geany
NoDisplay=true

so I don't think Nautilus is passing any funny options to Geany.

$ geany --version
geany 1.23 (built on Apr 24 2013 with GTK 2.18.9, GLib 2.22.5)

If I add a "-v" option to the *.desktop file, open four files, and then inspect the output in ~/.xsession-errors, I get this:

Geany-INFO: Geany 1.23, en_GB.UTF-8
Geany-INFO: GTK 2.20.1, GLib 2.26.1
Geany-INFO: System data dir: /mn/anatu/cma-u3/tmac/usr/stow/geany/share/geany
Geany-INFO: User config dir: /mn/anatu/cma-u3/tmac/.config/geany
symlink: File exists
Geany-INFO: Geany 1.23, en_GB.UTF-8
Geany-INFO: Geany 1.23, en_GB.UTF-8
Geany-INFO: GTK 2.20.1, GLib 2.26.1
Geany-INFO: GTK 2.20.1, GLib 2.26.1
Geany-INFO: System data dir: /mn/anatu/cma-u3/tmac/usr/stow/geany/share/geany
Geany-INFO: User config dir: /mn/anatu/cma-u3/tmac/.config/geany
Geany-INFO: System data dir: /mn/anatu/cma-u3/tmac/usr/stow/geany/share/geany
Geany-INFO: User config dir: /mn/anatu/cma-u3/tmac/.config/geany
Geany-INFO: using running instance of Geany
Geany-INFO: System plugin path: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany
Geany-INFO: System plugin path: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany
Geany-INFO: System plugin path: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany
Geany-INFO: Added filetype Cython (55).
Geany-INFO: Added filetype Cython (55).
Geany-INFO: Added filetype Genie (56).
Geany-INFO: Added filetype Go (57).
Geany-INFO: Added filetype Scala (58).
Geany-INFO: Added filetype Genie (56).
Geany-INFO: Added filetype Go (57).
Geany-INFO: Added filetype Scala (58).
Geany-INFO: Added filetype Cython (55).
Geany-INFO: Added filetype Genie (56).
Geany-INFO: Added filetype Go (57).
Geany-INFO: Added filetype Scala (58).
Geany-INFO: Disabling terminal support
Geany-INFO: Disabling terminal support
Geany-INFO: Disabling terminal support
Geany-INFO: Loaded: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany/geanyextrasel.so (Extra Selection)
Geany-INFO: Loaded: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany/geanyextrasel.so (Extra Selection)
Geany-INFO: Loaded: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany/geanyextrasel.so (Extra Selection)
Geany-INFO: Loaded: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany/geanylatex.so (GeanyLaTeX)
Geany-INFO: Loaded: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany/geanylatex.so (GeanyLaTeX)
Geany-INFO: Loaded: /mn/anatu/cma-u3/tmac/usr/stow/geany/lib/geany/geanylatex.so (GeanyLaTeX)
Geany-INFO: /mn/anatu/cma-u3/tmac/research/qcd/dirac_mg_stencil/source/mesh_c.hpp : C++ (UTF-8)
Geany-INFO: /mn/anatu/cma-u3/tmac/research/qcd/dirac_mg_stencil/source/mesh_euc_c.cpp : C++ (UTF-8)
Geany-INFO: /mn/anatu/cma-u3/tmac/research/qcd/dirac_mg_stencil/source/mesh_c.cpp : C++ (UTF-8)
Geany-INFO: Loaded /mn/anatu/cma-u3/tmac/usr/stow/geany/share/geany/c99.tags (C), 1618 tag(s).
Geany-INFO: Loaded /mn/anatu/cma-u3/tmac/usr/stow/geany/share/geany/c99.tags (C), 1618 tag(s).
Geany-INFO: Loaded /mn/anatu/cma-u3/tmac/usr/stow/geany/share/geany/c99.tags (C), 1618 tag(s).
Geany-INFO: /mn/anatu/cma-u3/tmac/research/qcd/dirac_mg_stencil/source/mesh_euc_c.hpp : C++ (UTF-8)

In this particular case, three instances of Geany was opened. Perhaps the statement "symlink: File exists" is a bit suspicious?

Best regards
Torquil Sørensen

Discussion

  • Lex Trotman

    Lex Trotman - 2014-03-18

    The problem is that Nautilus runs four separate geany commands, one for each file. So there is a race to see if the first one can get its socket file created before the second and subsequent ones test it. Clearly it is not winning, often.

    There is nothing much Geany can do in this case without much complication.

    Can you teach Nautilus to run one command with all the files as input?

     
  • Torquil Macdonald Sørensen

    Hmm, I think I have solved it. I checked the .desktop file specification for the Exec field syntax:

    http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

    and it says that using %F instead of %f should cause applications (which are capable of it) to pass multiple file arguments to a single command instead of running multiple commands. It seems that Nautilus is capable of this, because with %F it seems to always open just a single instance of Geany.

    In any case, I guess this should be closed.

     
  • Lex Trotman

    Lex Trotman - 2014-03-18
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks