Commit 15e7f14e2752f8a7c9e5e62be65d90dcde945908

Authored by Perry Werneck
Committed by GitHub
2 parents e06ae5ca 04c80754
Exists in develop

Merge pull request #25 from PerryWerneck/develop

Fixing codeQL alerts and exit segfault.
.github/workflows/codeql.yml
@@ -3,7 +3,7 @@ name: CodeQL @@ -3,7 +3,7 @@ name: CodeQL
3 on: 3 on:
4 push: 4 push:
5 branches: 5 branches:
6 - - master 6 + - develop
7 pull_request: 7 pull_request:
8 branches: 8 branches:
9 - master 9 - master
src/dialogs/colorscheme.c
@@ -417,7 +417,6 @@ @@ -417,7 +417,6 @@
417 } 417 }
418 418
419 g_message("Can't find color scheme"); 419 g_message("Can't find color scheme");
420 - //gtk_combo_box_set_active(GTK_COMBO_BOX(widget),-1);  
421 420
422 // TODO: Create an entry for this scheme as "custom" and select it. 421 // TODO: Create an entry for this scheme as "custom" and select it.
423 422
src/dialogs/font/chooser.c
@@ -204,8 +204,6 @@ @@ -204,8 +204,6 @@
204 204
205 if(chooser->font.face) { 205 if(chooser->font.face) {
206 206
207 -// debug("%s",__FUNCTION__);  
208 -  
209 cairo_set_font_face(cr,chooser->font.face); 207 cairo_set_font_face(cr,chooser->font.face);
210 cairo_set_font_size(cr,15); 208 cairo_set_font_size(cr,15);
211 209
src/dialogs/load.c
@@ -141,9 +141,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -141,9 +141,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
141 // 0 - Filename xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx. x 141 // 0 - Filename xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx.xxxxxxxxx. x
142 // 1 - Charset xxxxxxxxx.xxxxxxxxx. Format: xxxxxxxxx.xxxxxxxxx. 142 // 1 - Charset xxxxxxxxx.xxxxxxxxx. Format: xxxxxxxxx.xxxxxxxxx.
143 143
144 -  
145 -// gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE);  
146 -  
147 // Setup visual elements 144 // Setup visual elements
148 // https://developer.gnome.org/hig/stable/visual-layout.html.en 145 // https://developer.gnome.org/hig/stable/visual-layout.html.en
149 GtkWidget *widget; 146 GtkWidget *widget;
@@ -171,13 +168,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ @@ -171,13 +168,6 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_
171 gtk_grid_attach(grid,widget,0,0,1,1); 168 gtk_grid_attach(grid,widget,0,0,1,1);
172 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename); 169 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename);
173 170
174 - /*  
175 - gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-open");  
176 - gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE);  
177 - gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file"));  
178 - g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog);  
179 - */  
180 -  
181 g_signal_connect(dialog->filename,"changed",G_CALLBACK(filename_changed),dialog); 171 g_signal_connect(dialog->filename,"changed",G_CALLBACK(filename_changed),dialog);
182 172
183 gtk_entry_bind_to_filechooser( 173 gtk_entry_bind_to_filechooser(
src/dialogs/print/draw.c
@@ -114,8 +114,6 @@ @@ -114,8 +114,6 @@
114 size_t col; 114 size_t col;
115 rect.x = operation->font.info.margin.left; 115 rect.x = operation->font.info.margin.left;
116 116
117 -// debug("Drawing: %u row=%u selection=%p pos=%u", (unsigned int) drawing, row, selection, (unsigned int) pos);  
118 -  
119 for(col = 0; col < selection->bounds.width;col++) 117 for(col = 0; col < selection->bounds.width;col++)
120 { 118 {
121 if(selection->contents[pos].chr) 119 if(selection->contents[pos].chr)
src/dialogs/print/print.c
@@ -212,7 +212,7 @@ @@ -212,7 +212,7 @@
212 // Setup defaults 212 // Setup defaults
213 widget->mode = LIB3270_CONTENT_ALL; 213 widget->mode = LIB3270_CONTENT_ALL;
214 widget->settings.show_selection = FALSE; 214 widget->settings.show_selection = FALSE;
215 - widget->font.name = NULL; // g_strdup(v3270_default_font); 215 + widget->font.name = NULL;
216 216
217 } 217 }
218 218
src/dialogs/print/private.h
@@ -27,6 +27,8 @@ @@ -27,6 +27,8 @@
27 * 27 *
28 */ 28 */
29 29
  30 + #pragma once
  31 +
30 #include <v3270.h> 32 #include <v3270.h>
31 #include <v3270/print.h> 33 #include <v3270/print.h>
32 #include <lib3270/log.h> 34 #include <lib3270/log.h>
src/dialogs/print/settings.c
@@ -91,9 +91,6 @@ static void V3270PrintSettings_init(V3270PrintSettings *widget) @@ -91,9 +91,6 @@ static void V3270PrintSettings_init(V3270PrintSettings *widget)
91 gtk_grid_set_row_spacing(GTK_GRID(widget),6); 91 gtk_grid_set_row_spacing(GTK_GRID(widget),6);
92 gtk_grid_set_column_spacing(GTK_GRID(widget),12); 92 gtk_grid_set_column_spacing(GTK_GRID(widget),12);
93 93
94 - // g_signal_connect(G_OBJECT(widget->color),"update-colors",G_CALLBACK(color_scheme_changed),widget);  
95 - // g_signal_connect(G_OBJECT(widget->selected),"toggled",G_CALLBACK(toggle_show_selection),widget);  
96 -  
97 for(f=0;f<G_N_ELEMENTS(text);f++) 94 for(f=0;f<G_N_ELEMENTS(text);f++)
98 { 95 {
99 GtkWidget *label = gtk_label_new_with_mnemonic(g_dgettext(GETTEXT_PACKAGE,text[f])); 96 GtkWidget *label = gtk_label_new_with_mnemonic(g_dgettext(GETTEXT_PACKAGE,text[f]));
src/dialogs/save/private.h
@@ -27,6 +27,8 @@ @@ -27,6 +27,8 @@
27 * 27 *
28 */ 28 */
29 29
  30 + #pragma once
  31 +
30 #include <internals.h> 32 #include <internals.h>
31 33
32 #include <libintl.h> 34 #include <libintl.h>
src/dialogs/settings/private.h
@@ -27,60 +27,59 @@ @@ -27,60 +27,59 @@
27 * 27 *
28 */ 28 */
29 29
30 -#ifndef PRIVATE_H_INCLUDED 30 + #pragma once
31 31
32 - #include <internals.h>  
33 - #include <lib3270/log.h>  
34 - #include <lib3270/toggle.h>  
35 - #include <v3270/settings.h> 32 + #include <internals.h>
  33 + #include <lib3270/log.h>
  34 + #include <lib3270/toggle.h>
  35 + #include <v3270/settings.h>
36 36
37 - /// @brief Toggle button factory.  
38 - struct ToggleButtonDefinition {  
39 - gint left;  
40 - gint top;  
41 - gint width;  
42 - unsigned short grid;  
43 - LIB3270_TOGGLE_ID id;  
44 - }; 37 + /// @brief Toggle button factory.
  38 + struct ToggleButtonDefinition {
  39 + gint left;
  40 + gint top;
  41 + gint width;
  42 + unsigned short grid;
  43 + LIB3270_TOGGLE_ID id;
  44 + };
45 45
46 - G_GNUC_INTERNAL void v3270_settings_create_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **toggles);  
47 - G_GNUC_INTERNAL void v3270_settings_load_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles);  
48 - G_GNUC_INTERNAL void v3270_settings_apply_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles); 46 + G_GNUC_INTERNAL void v3270_settings_create_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **toggles);
  47 + G_GNUC_INTERNAL void v3270_settings_load_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles);
  48 + G_GNUC_INTERNAL void v3270_settings_apply_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles);
49 49
50 - /// @brief Entry field factory.  
51 - struct EntryFieldDefinition { 50 + /// @brief Entry field factory.
  51 + struct EntryFieldDefinition {
52 52
53 - ENTRY_FIELD_HEAD 53 + ENTRY_FIELD_HEAD
54 54
55 - unsigned short grid;  
56 - gint max_length;  
57 - gint width_chars; 55 + unsigned short grid;
  56 + gint max_length;
  57 + gint width_chars;
58 58
59 - }; 59 + };
60 60
61 - G_GNUC_INTERNAL void v3270_settings_create_entry_fields(const struct EntryFieldDefinition * definitions, size_t length, GtkWidget **grids, GtkEntry **entries); 61 + G_GNUC_INTERNAL void v3270_settings_create_entry_fields(const struct EntryFieldDefinition * definitions, size_t length, GtkWidget **grids, GtkEntry **entries);
62 62
63 - /// @brief Combo Box factory  
64 - struct ComboBoxDefinition { 63 + /// @brief Combo Box factory
  64 + struct ComboBoxDefinition {
65 65
66 - ENTRY_FIELD_HEAD 66 + ENTRY_FIELD_HEAD
67 67
68 - unsigned short grid; 68 + unsigned short grid;
69 69
70 - gint n_columns;  
71 - const GType *types; 70 + gint n_columns;
  71 + const GType *types;
72 72
73 - }; 73 + };
74 74
75 - G_GNUC_INTERNAL void v3270_settings_create_combos(const struct ComboBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkComboBox **combos); 75 + G_GNUC_INTERNAL void v3270_settings_create_combos(const struct ComboBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkComboBox **combos);
76 76
77 - /// @brief Checkbox factory  
78 - struct CheckBoxDefinition {  
79 - ENTRY_FIELD_HEAD 77 + /// @brief Checkbox factory
  78 + struct CheckBoxDefinition {
  79 + ENTRY_FIELD_HEAD
80 80
81 - unsigned short grid;  
82 - }; 81 + unsigned short grid;
  82 + };
83 83
84 - G_GNUC_INTERNAL void v3270_settings_create_checkboxes(const struct CheckBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **buttons); 84 + G_GNUC_INTERNAL void v3270_settings_create_checkboxes(const struct CheckBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **buttons);
85 85
86 -#endif // PRIVATE_H_INCLUDED  
src/filetransfer/v3270ft.c
@@ -103,16 +103,18 @@ static void transfer_type_changed(GtkComboBox *widget, v3270ft *dialog) { @@ -103,16 +103,18 @@ static void transfer_type_changed(GtkComboBox *widget, v3270ft *dialog) {
103 // Tem opção seleciona 103 // Tem opção seleciona
104 104
105 struct v3270ft_entry *entry = v3270ft_get_selected(dialog); 105 struct v3270ft_entry *entry = v3270ft_get_selected(dialog);
106 - LIB3270_FT_OPTION opt = entry->options & ~(LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP); 106 + if(entry) {
  107 + LIB3270_FT_OPTION opt = entry->options & ~(LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP);
107 108
108 - opt |= ft_type[selected].opt; 109 + opt |= ft_type[selected].opt;
109 110
110 - entry->type = selected;  
111 - debug("Transfer type=%d opt=%08x last=%08x",selected,opt,entry->options); 111 + entry->type = selected;
  112 + debug("Transfer type=%d opt=%08x last=%08x",selected,opt,entry->options);
112 113
113 - if(entry->options != opt) {  
114 - debug("Transfer type=%d opt=%08x",selected,opt);  
115 - v3270ft_set_options(GTK_WIDGET(dialog),opt); 114 + if(entry->options != opt) {
  115 + debug("Transfer type=%d opt=%08x",selected,opt);
  116 + v3270ft_set_options(GTK_WIDGET(dialog),opt);
  117 + }
116 } 118 }
117 119
118 } 120 }
@@ -290,11 +292,7 @@ static gboolean spin_format(GtkSpinButton *spin, G_GNUC_UNUSED gpointer data) { @@ -290,11 +292,7 @@ static gboolean spin_format(GtkSpinButton *spin, G_GNUC_UNUSED gpointer data) {
290 return TRUE; 292 return TRUE;
291 } 293 }
292 294
293 -//#ifdef WIN32  
294 -//static void select_local_file(GtkButton G_GNUC_UNUSED(*button), v3270ft *dialog) {  
295 -//#else  
296 static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, v3270ft *dialog) { 295 static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, v3270ft *dialog) {
297 -//#endif // WIN32  
298 296
299 debug("%s: action=%d",__FUNCTION__, (int) GTK_FILE_CHOOSER_ACTION_OPEN); 297 debug("%s: action=%d",__FUNCTION__, (int) GTK_FILE_CHOOSER_ACTION_OPEN);
300 298
src/include/terminal.h
@@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */ 18 */
19 19
  20 + #pragma once
  21 +
20 #include <config.h> 22 #include <config.h>
21 #include <internals.h> 23 #include <internals.h>
22 #include <v3270/selection.h> 24 #include <v3270/selection.h>
src/include/v3270/accessible.h
@@ -27,47 +27,46 @@ @@ -27,47 +27,46 @@
27 * 27 *
28 */ 28 */
29 29
30 -#include <gtk/gtk.h> 30 + #pragma once
31 31
32 -G_BEGIN_DECLS 32 + #include <gtk/gtk.h>
33 33
34 -#define GTK_TYPE_V3270_ACCESSIBLE (v3270_accessible_get_type ())  
35 -#define GTK_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270Accessible))  
36 -#define GTK_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass))  
37 -#define GTK_IS_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270_ACCESSIBLE))  
38 -#define GTK_IS_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270_ACCESSIBLE))  
39 -#define GTK_V3270_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass)) 34 + G_BEGIN_DECLS
40 35
41 -typedef struct _v3270Accessible v3270Accessible;  
42 -typedef struct _v3270AccessibleClass v3270AccessibleClass; 36 + #define GTK_TYPE_V3270_ACCESSIBLE (v3270_accessible_get_type ())
  37 + #define GTK_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270Accessible))
  38 + #define GTK_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass))
  39 + #define GTK_IS_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270_ACCESSIBLE))
  40 + #define GTK_IS_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270_ACCESSIBLE))
  41 + #define GTK_V3270_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass))
43 42
44 -typedef enum _v3270_state  
45 -{ 43 + typedef struct _v3270Accessible v3270Accessible;
  44 + typedef struct _v3270AccessibleClass v3270AccessibleClass;
  45 +
  46 + typedef enum _v3270_state
  47 + {
46 V3270_STATE_NONE = 0x0000, 48 V3270_STATE_NONE = 0x0000,
47 V3270_STATE_EDITABLE = 0x0001, 49 V3270_STATE_EDITABLE = 0x0001,
48 V3270_STATE_BUSY = 0x0002, 50 V3270_STATE_BUSY = 0x0002,
49 V3270_STATE_ENABLED = 0x0004, 51 V3270_STATE_ENABLED = 0x0004,
50 V3270_STATE_INVALID_ENTRY = 0x0008, 52 V3270_STATE_INVALID_ENTRY = 0x0008,
51 53
52 -} V3270_STATE; 54 + } V3270_STATE;
53 55
54 -struct _v3270Accessible  
55 -{ 56 + struct _v3270Accessible
  57 + {
56 GtkAccessible parent; 58 GtkAccessible parent;
57 V3270_STATE state; 59 V3270_STATE state;
58 60
59 -// AtkLayer layer;  
60 -}; 61 + };
61 62
62 -struct _v3270AccessibleClass  
63 -{ 63 + struct _v3270AccessibleClass
  64 + {
64 GtkAccessibleClass parent_class; 65 GtkAccessibleClass parent_class;
  66 + };
65 67
  68 + GType v3270_accessible_get_type(void);
66 69
67 -};  
68 -  
69 -GType v3270_accessible_get_type(void);  
70 -  
71 -void v3270_acessible_set_state(GtkAccessible *obj, LIB3270_MESSAGE id); 70 + void v3270_acessible_set_state(GtkAccessible *obj, LIB3270_MESSAGE id);
72 71
73 -G_END_DECLS 72 + G_END_DECLS
src/include/v3270/colorscheme.h
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 * 27 *
28 */ 28 */
29 29
30 -#ifndef V3270_COLOR_SCHEME_H_INCLUDED 30 + #pragma once
31 31
32 #include <gtk/gtk.h> 32 #include <gtk/gtk.h>
33 33
@@ -69,4 +69,3 @@ @@ -69,4 +69,3 @@
69 69
70 G_END_DECLS 70 G_END_DECLS
71 71
72 -#endif // V3270_COLOR_SCHEME_H_INCLUDED  
src/include/v3270/tools.h
@@ -27,27 +27,25 @@ @@ -27,27 +27,25 @@
27 * 27 *
28 */ 28 */
29 29
30 -#ifndef V3270_TOOLS_H_INCLUDED 30 + #pragma once
31 31
32 #include <gtk/gtk.h> 32 #include <gtk/gtk.h>
33 #include <lib3270.h> 33 #include <lib3270.h>
34 34
35 G_BEGIN_DECLS 35 G_BEGIN_DECLS
36 36
37 - /// @brief Bind pointer to widget; release it when widget is destroyed.  
38 - LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr); 37 + /// @brief Bind pointer to widget; release it when widget is destroyed.
  38 + LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr);
39 39
40 - /// @brief Add style to widget.  
41 - LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className); 40 + /// @brief Add style to widget.
  41 + LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className);
42 42
43 - /// @brief Bind file chooser with entry field.  
44 - LIB3270_EXPORT void gtk_entry_bind_to_filechooser(GtkWidget *widget, GtkFileChooserAction action, const gchar *title, const gchar *icon_name, const gchar *pattern, const gchar *name);  
45 -  
46 - /// @brief Bind dialog with toplevel  
47 - LIB3270_EXPORT void gtk_dialog_set_toplevel(GtkWidget *dialog, GtkWidget *widget); 43 + /// @brief Bind file chooser with entry field.
  44 + LIB3270_EXPORT void gtk_entry_bind_to_filechooser(GtkWidget *widget, GtkFileChooserAction action, const gchar *title, const gchar *icon_name, const gchar *pattern, const gchar *name);
48 45
  46 + /// @brief Bind dialog with toplevel
  47 + LIB3270_EXPORT void gtk_dialog_set_toplevel(GtkWidget *dialog, GtkWidget *widget);
49 48
50 G_END_DECLS 49 G_END_DECLS
51 50
52 -#endif // V3270_TOOLS_H_INCLUDED  
53 51
src/terminal/actions/private.h
@@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */ 18 */
19 19
  20 + #pragma once
  21 +
20 #include <config.h> 22 #include <config.h>
21 23
22 #include <glib.h> 24 #include <glib.h>
src/terminal/keyboard/accelerator.c
@@ -71,33 +71,11 @@ @@ -71,33 +71,11 @@
71 71
72 gboolean v3270_accelerator_compare(const V3270Accelerator * accel, const guint keyval, const GdkModifierType mods) 72 gboolean v3270_accelerator_compare(const V3270Accelerator * accel, const guint keyval, const GdkModifierType mods)
73 { 73 {
74 - // Problems:  
75 -  
76 -// debug("%s: keys: %08x %08x",__FUNCTION__,accel->key,keyval);  
77 -  
78 - // It's the same key?  
79 - if(accel->key != keyval)  
80 - {  
81 - g_autofree gchar * acckey = gtk_accelerator_name(accel->key,accel->mods);  
82 - g_autofree gchar * qkey = gtk_accelerator_name(keyval,mods);  
83 -// debug("%s: Rejected by key %08x %08x (%s %s)",__FUNCTION__,accel->key,keyval,acckey,qkey); 74 + // It's the same key and mods?
  75 + if(accel->key != keyval || accel->mods != mods)
84 return FALSE; 76 return FALSE;
85 - }  
86 77
87 // The same key and same mods, Found it! 78 // The same key and same mods, Found it!
88 - if(accel->mods == mods)  
89 - return TRUE;  
90 -  
91 -/*  
92 -#ifdef DEBUG  
93 - {  
94 - g_autofree gchar * acckey = gtk_accelerator_name(accel->key,accel->mods);  
95 - g_autofree gchar * qkey = gtk_accelerator_name(keyval,mods);  
96 -// debug("%s: accel=%s (%0u/%08x) query=%s (%u/%08x) xor=%08x and=%08x",__FUNCTION__,acckey,accel->key,accel->mods,qkey,keyval,mods,(accel->mods^mods),(accel->mods & mods));  
97 - }  
98 -#endif // DEBUG  
99 -*/  
100 -  
101 return TRUE; 79 return TRUE;
102 } 80 }
103 81
src/terminal/properties/private.h
@@ -17,11 +17,13 @@ @@ -17,11 +17,13 @@
17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20 -#ifdef WIN32 20 + #pragma once
  21 +
  22 + #ifdef WIN32
21 #include <winsock2.h> 23 #include <winsock2.h>
22 #include <windows.h> 24 #include <windows.h>
23 #include <ws2tcpip.h> 25 #include <ws2tcpip.h>
24 -#endif // WIN32 26 + #endif // WIN32
25 27
26 #include <gtk/gtk.h> 28 #include <gtk/gtk.h>
27 #include <limits.h> 29 #include <limits.h>
src/trace/private.h
@@ -27,44 +27,38 @@ @@ -27,44 +27,38 @@
27 * 27 *
28 */ 28 */
29 29
30 -#ifndef PRIVATE_H_INCLUDED 30 + #pragma once
31 31
32 - #include <config.h> 32 + #include <config.h>
33 33
34 - #include <gtk/gtk.h> 34 + #include <gtk/gtk.h>
35 35
  36 + #ifndef ENABLE_NLS
36 #define ENABLE_NLS 37 #define ENABLE_NLS
  38 + #endif // ENABLE_NLS
37 39
38 - #include <libintl.h>  
39 - #include <glib/gi18n-lib.h> 40 + #include <libintl.h>
  41 + #include <glib/gi18n-lib.h>
40 42
41 - #include <v3270.h>  
42 - #include <v3270/trace.h> 43 + #include <v3270.h>
  44 + #include <v3270/trace.h>
43 45
44 - #include <lib3270.h>  
45 - #include <lib3270/log.h>  
46 - #include <lib3270/trace.h> 46 + #include <lib3270.h>
  47 + #include <lib3270/log.h>
  48 + #include <lib3270/trace.h>
47 49
48 - /// @brief V3270 Trace Signal list  
49 - enum V3270_TRACE_SIGNAL  
50 - {  
51 - V3270_TRACE_SIGNAL_COMMAND, 50 + /// @brief V3270 Trace Signal list
  51 + enum V3270_TRACE_SIGNAL
  52 + {
  53 + V3270_TRACE_SIGNAL_COMMAND,
52 54
53 - V3270_TRACE_SIGNAL_LAST  
54 - }; 55 + V3270_TRACE_SIGNAL_LAST
  56 + };
55 57
56 - G_GNUC_INTERNAL H3270 * v3270_trace_get_session(GtkWidget *widget);  
57 - G_GNUC_INTERNAL GtkWidget * v3270_trace_get_terminal(GtkWidget *widget);  
58 - G_GNUC_INTERNAL GtkTextBuffer * v3270_trace_get_text_buffer(GtkWidget *widget);  
59 - G_GNUC_INTERNAL GtkScrolledWindow * v3270_trace_get_scrolled_window(GtkWidget *widget);  
60 - G_GNUC_INTERNAL void v3270_trace_signal_emit(gpointer instance, enum V3270_TRACE_SIGNAL signal_id, ...); 58 + G_GNUC_INTERNAL H3270 * v3270_trace_get_session(GtkWidget *widget);
  59 + G_GNUC_INTERNAL GtkWidget * v3270_trace_get_terminal(GtkWidget *widget);
  60 + G_GNUC_INTERNAL GtkTextBuffer * v3270_trace_get_text_buffer(GtkWidget *widget);
  61 + G_GNUC_INTERNAL GtkScrolledWindow * v3270_trace_get_scrolled_window(GtkWidget *widget);
  62 + G_GNUC_INTERNAL void v3270_trace_signal_emit(gpointer instance, enum V3270_TRACE_SIGNAL signal_id, ...);
61 63
62 - G_BEGIN_DECLS  
63 -  
64 -  
65 - G_END_DECLS  
66 -  
67 -  
68 -  
69 -#endif // PRIVATE_H_INCLUDED  
70 64
src/trace/text.c
@@ -61,6 +61,9 @@ @@ -61,6 +61,9 @@
61 gtk_adjustment_set_value(vadj,gtk_adjustment_get_upper(vadj)); 61 gtk_adjustment_set_value(vadj,gtk_adjustment_get_upper(vadj));
62 gtk_scrolled_window_set_vadjustment(scrolled, vadj); 62 gtk_scrolled_window_set_vadjustment(scrolled, vadj);
63 63
  64 + // Release reference from v3270_trace_append_text.
  65 + g_object_unref(cfg->widget);
  66 +
64 return FALSE; 67 return FALSE;
65 68
66 } 69 }
@@ -74,6 +77,9 @@ @@ -74,6 +77,9 @@
74 cfg->widget = widget; 77 cfg->widget = widget;
75 strcpy(cfg->text,text); 78 strcpy(cfg->text,text);
76 79
  80 + // Get reference to widget.
  81 + g_object_ref(cfg->widget);
  82 +
77 g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,(GSourceFunc) bg_append_text, cfg, g_free); 83 g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,(GSourceFunc) bg_append_text, cfg, g_free);
78 84
79 } 85 }