[geany/geany] 4c8d2f: Fix handling of --list-documents when no other instance are running
Colomban Wendling
git-noreply at xxxxx
Thu Dec 19 19:45:25 UTC 2013
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Thu, 19 Dec 2013 19:45:25 UTC
Commit: 4c8d2fb9286227861c62d2ef1c80d6627d032e3d
https://github.com/geany/geany/commit/4c8d2fb9286227861c62d2ef1c80d6627d032e3d
Log Message:
-----------
Fix handling of --list-documents when no other instance are running
Properly exit when passed --list-documents, even if no other instance
were already running. This makes this option behave the same in any
case, making it easier to use in e.g. scripts.
Modified Paths:
--------------
NEWS
src/main.c
Modified: NEWS
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -10,6 +10,8 @@ Geany 1.24 (unreleased)
* Fix stopping of some spawned commands.
* Fix cursor position and selection after comment toggling (#3576431).
* Fix truncated output of ``--list-documents`` command-line option.
+ * Fix launching a new instance when ``--list-documents`` is passed and
+ no other instance is running.
Interface
* Fix custom GTK styles under KDE (#3607935).
Modified: src/main.c
30 files changed, 16 insertions(+), 14 deletions(-)
===================================================================
@@ -1076,21 +1076,23 @@ gint main(gint argc, gchar **argv)
socket_info.lock_socket = -1;
socket_info.lock_socket_tag = 0;
socket_info.lock_socket = socket_init(argc, argv);
- /* Socket exists */
- if (socket_info.lock_socket == -2)
+ /* Quit if filenames were sent to first instance or the list of open
+ * documents has been printed */
+ if ((socket_info.lock_socket == -2 /* socket exists */ && argc > 1) ||
+ cl_options.list_documents)
+ {
+ socket_finalize();
+ gdk_notify_startup_complete();
+ g_free(app->configdir);
+ g_free(app->datadir);
+ g_free(app->docdir);
+ g_free(app);
+ return 0;
+ }
+ /* Start a new instance if no command line strings were passed,
+ * even if the socket already exists */
+ else if (socket_info.lock_socket == -2 /* socket already exists */)
{
- /* Quit if filenames were sent to first instance or the list of open
- * documents has been sent */
- if (argc > 1 || cl_options.list_documents)
- {
- gdk_notify_startup_complete();
- g_free(app->configdir);
- g_free(app->datadir);
- g_free(app->docdir);
- g_free(app);
- return 0;
- }
- /* Start a new instance if no command line strings were passed */
socket_info.ignore_socket = TRUE;
cl_options.new_instance = TRUE;
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list