1 |
vostorga 10/10/27 19:42:04 |
2 |
|
3 |
Added: lxlauncher-0.2.1-fix-segfault.patch |
4 |
Log: |
5 |
Fixing segmentation fault, bug #341561 |
6 |
(Portage version: 2.1.8.3/cvs/Linux i686) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 lxde-base/lxlauncher/files/lxlauncher-0.2.1-fix-segfault.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/lxde-base/lxlauncher/files/lxlauncher-0.2.1-fix-segfault.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/lxde-base/lxlauncher/files/lxlauncher-0.2.1-fix-segfault.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: lxlauncher-0.2.1-fix-segfault.patch |
15 |
=================================================================== |
16 |
--- src/lxlauncher.c 2009-07-07 15:48:19.000000000 +0300 |
17 |
+++ src/lxlauncher.c.new 2010-06-09 21:09:24.000000000 +0300 |
18 |
@@ -311,6 +311,7 @@ |
19 |
{ |
20 |
// Dirty hacks used to force pseudo-transparent background |
21 |
gtk_widget_queue_draw( data->table ); |
22 |
+ return TRUE; |
23 |
} |
24 |
|
25 |
// Dirty hacks used to reduce unnecessary redrew during scroll |
26 |
@@ -662,18 +663,38 @@ |
27 |
gchar *file; |
28 |
|
29 |
file = g_build_filename(user_dir, name, NULL); |
30 |
- if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE) { |
31 |
- return file; |
32 |
- } |
33 |
+ if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE) |
34 |
+ return file; |
35 |
free(file); |
36 |
|
37 |
for (dir = system_dirs; *dir; ++dir ) { |
38 |
- file = g_build_filename(*dir, name, NULL); |
39 |
- if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE) { |
40 |
- return file; |
41 |
- } |
42 |
- free(file); |
43 |
+ file = g_build_filename(*dir, name, NULL); |
44 |
+ if (g_file_test(file, G_FILE_TEST_EXISTS) == TRUE) |
45 |
+ return file; |
46 |
+ free(file); |
47 |
+ } |
48 |
+ return NULL; |
49 |
+} |
50 |
+ |
51 |
+static void on_menu_cache_reload(MenuCache* mc, gpointer user_data) |
52 |
+{ |
53 |
+ GMainLoop* mainloop = (GMainLoop*)user_data; |
54 |
+ g_main_loop_quit(mainloop); |
55 |
+} |
56 |
+ |
57 |
+MenuCache* _menu_cache_lookup_sync( const char* menu_name ) |
58 |
+{ |
59 |
+ MenuCache* mc = menu_cache_lookup(menu_name); |
60 |
+ /* ensure that the menu cache is loaded */ |
61 |
+ if(! menu_cache_get_root_dir(mc)) /* if it's not yet loaded */ |
62 |
+ { |
63 |
+ GMainLoop* mainloop = g_main_loop_new(NULL, FALSE); |
64 |
+ gpointer notify_id = menu_cache_add_reload_notify(mc, on_menu_cache_reload, mainloop); |
65 |
+ g_main_loop_run(mainloop); |
66 |
+ g_main_loop_unref(mainloop); |
67 |
+ menu_cache_remove_reload_notify(mc, notify_id); |
68 |
} |
69 |
+ return mc; |
70 |
} |
71 |
|
72 |
int main(int argc, char** argv) |
73 |
@@ -695,13 +716,14 @@ |
74 |
GError *error = NULL; |
75 |
gchar *config_file = get_xdg_config_file(CONFIG_FILE); |
76 |
if (config_file && |
77 |
- g_key_file_load_from_file(key_file, |
78 |
- config_file, |
79 |
- G_KEY_FILE_NONE, |
80 |
- &error)) { |
81 |
- printf("Loaded %s\n", config_file); |
82 |
- } else { |
83 |
- perror("Error loading " CONFIG_FILE); |
84 |
+ g_key_file_load_from_file(key_file, |
85 |
+ config_file, |
86 |
+ G_KEY_FILE_NONE, |
87 |
+ &error)) { |
88 |
+ printf("Loaded %s\n", config_file); |
89 |
+ } |
90 |
+ else { |
91 |
+ perror("Error loading " CONFIG_FILE); |
92 |
} |
93 |
if (config_file) |
94 |
free(config_file); |
95 |
@@ -711,21 +733,23 @@ |
96 |
// Add application specific properties |
97 |
gtk_settings_install_property(g_param_spec_boolean("lxlauncher-enable-key", |
98 |
_("Enable key navigation"), |
99 |
- _("Allow users to use up/down/left/right/tab/enter keys to operate the lxlaucher"), |
100 |
+ _("Allow users to use up/down/left/right/tab/enter keys to operate the lxlauncher"), |
101 |
FALSE,GTK_ARG_READWRITE)); |
102 |
// set up themes for notebook |
103 |
gchar* gtkrc_file = get_xdg_config_file("lxlauncher/gtkrc"); |
104 |
gtk_rc_parse(gtkrc_file); |
105 |
if (gtkrc_file) { |
106 |
- free(gtkrc_file); |
107 |
+ free(gtkrc_file); |
108 |
} |
109 |
|
110 |
button_size = g_key_file_get_integer(key_file, "Main", "BUTTON_SIZE", NULL); |
111 |
img_size = g_key_file_get_integer(key_file, "Main", "IMG_SIZE", NULL); |
112 |
|
113 |
// to prevent from going without configure file |
114 |
- if(!button_size) button_size = BUTTON_SIZE_FALLBACK; |
115 |
- if(!img_size) img_size = IMG_SIZE_FALLBACK; |
116 |
+ if(!button_size) |
117 |
+ button_size = BUTTON_SIZE_FALLBACK; |
118 |
+ if(!img_size) |
119 |
+ img_size = IMG_SIZE_FALLBACK; |
120 |
|
121 |
icon_size = gtk_icon_size_register( "ALIcon", img_size, img_size ); |
122 |
|
123 |
@@ -756,9 +780,14 @@ |
124 |
gtk_container_add( (GtkContainer*)main_window, notebook ); |
125 |
|
126 |
g_setenv("XDG_MENU_PREFIX", "lxlauncher-", TRUE); |
127 |
- menu_tree = menu_cache_lookup( "applications.menu" ); |
128 |
+ menu_tree = _menu_cache_lookup_sync( "applications.menu" ); |
129 |
+ if(!menu_tree) |
130 |
+ { |
131 |
+ g_print("Unable to load application menu\n"); |
132 |
+ return 1; |
133 |
+ } |
134 |
+ root_dir = menu_cache_item_ref(menu_cache_get_root_dir( menu_tree )); |
135 |
reload_notify_id = menu_cache_add_reload_notify( menu_tree, on_menu_tree_changed, NULL ); |
136 |
- root_dir = menu_cache_ref(menu_cache_get_root_dir( menu_tree )); |
137 |
|
138 |
create_notebook_pages(); |