[Xfce4-commits] [apps/xfce4-terminal] 01/01: Fix clang-analyzer warnings
noreply at xfce.org
noreply at xfce.org
Tue Jul 12 14:09:28 CEST 2016
This is an automated email from the git hooks/post-receive script.
f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.
commit c7c67265850eac23141fe66b3899112129e5c3de
Author: Igor <f2404 at yandex.ru>
Date: Tue Jul 12 15:09:16 2016 +0300
Fix clang-analyzer warnings
---
terminal/terminal-app.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/terminal/terminal-app.c b/terminal/terminal-app.c
index 82242cf..3766ebb 100644
--- a/terminal/terminal-app.c
+++ b/terminal/terminal-app.c
@@ -473,7 +473,7 @@ terminal_app_save_yourself (XfceSMClient *client,
argc = g_slist_length (result) + 1;
argv = g_new (gchar*, argc + 1);
- for (lp = result, n = 1; n < argc; lp = lp->next, ++n)
+ for (lp = result, n = 1; n < argc && lp != NULL; lp = lp->next, ++n)
argv[n] = lp->data;
argv[n] = NULL;
@@ -640,9 +640,10 @@ terminal_app_open_window (TerminalApp *app,
GdkDisplay *attr_display;
gint attr_screen_num;
#if GTK_CHECK_VERSION (3,20,0)
+ TerminalScreen *active_terminal;
gint width, height;
- glong char_width, char_height;
- gint xpad, ypad;
+ glong char_width = 1, char_height = 1;
+ gint xpad = 0, ypad = 0;
#endif
terminal_return_if_fail (TERMINAL_IS_APP (app));
@@ -749,10 +750,6 @@ terminal_app_open_window (TerminalApp *app,
terminal_window_add (TERMINAL_WINDOW (window), TERMINAL_SCREEN (terminal));
terminal_screen_launch_child (TERMINAL_SCREEN (terminal));
-
-#if GTK_CHECK_VERSION (3,20,0)
- terminal_screen_get_geometry (TERMINAL_SCREEN (terminal), &char_width, &char_height, &xpad, &ypad);
-#endif
}
if (!attr->drop_down)
@@ -775,7 +772,12 @@ terminal_app_open_window (TerminalApp *app,
/* try to apply the geometry to the window */
#if GTK_CHECK_VERSION (3,20,0)
if (terminal_app_parse_geometry (geometry, &width, &height))
- gtk_window_set_default_size (GTK_WINDOW (window), width * char_width + xpad, height * char_height + ypad);
+ {
+ active_terminal = terminal_window_get_active (TERMINAL_WINDOW (window));
+ if (G_LIKELY (active_terminal != NULL))
+ terminal_screen_get_geometry (active_terminal, &char_width, &char_height, &xpad, &ypad);
+ gtk_window_set_default_size (GTK_WINDOW (window), width * char_width + xpad, height * char_height + ypad);
+ }
else
#else
if (!gtk_window_parse_geometry (GTK_WINDOW (window), geometry))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list