summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-12-21 10:12:39 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-12-21 10:12:39 +0000
commite8061c0a358bceed4d1a6155ccbc2da5b060c36c (patch)
tree39b1f1da6f2f8bc58d0fbd6b986eeef253788613
parentb13ca641f7d9842c384eb25888a64bb530f97ada (diff)
fix a stringshare error in desk config and also a possible crash
SVN revision: 81528
-rw-r--r--src/modules/conf_display/e_int_config_desk.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/modules/conf_display/e_int_config_desk.c b/src/modules/conf_display/e_int_config_desk.c
index e6e4c4fbf..475e63a6a 100644
--- a/src/modules/conf_display/e_int_config_desk.c
+++ b/src/modules/conf_display/e_int_config_desk.c
@@ -13,7 +13,7 @@ struct _E_Config_Dialog_Data
13 int zone_num; 13 int zone_num;
14 int desk_x; 14 int desk_x;
15 int desk_y; 15 int desk_y;
16 char *bg; 16 Eina_Stringshare *bg;
17 char *name; 17 char *name;
18#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) 18#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
19 char *profile; 19 char *profile;
@@ -60,16 +60,12 @@ static void
60_fill_data(E_Config_Dialog_Data *cfdata) 60_fill_data(E_Config_Dialog_Data *cfdata)
61{ 61{
62 Eina_List *l; 62 Eina_List *l;
63 const char *bg;
64 char name[40]; 63 char name[40];
65 int ok = 0; 64 int ok = 0;
66#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) 65#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
67 E_Config_Desktop_Window_Profile *prof; 66 E_Config_Desktop_Window_Profile *prof;
68#endif 67#endif
69 bg = e_bg_file_get(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); 68 cfdata->bg = e_bg_file_get(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y);
70 if (!bg)
71 bg = e_theme_edje_file_get("base/theme/backgrounds", "e/desktop/background");
72 cfdata->bg = strdup(bg);
73 69
74 for (l = e_config->desktop_names; l; l = l->next) 70 for (l = e_config->desktop_names; l; l = l->next)
75 { 71 {
@@ -129,8 +125,7 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
129{ 125{
130 if (cfdata->hdl) 126 if (cfdata->hdl)
131 ecore_event_handler_del(cfdata->hdl); 127 ecore_event_handler_del(cfdata->hdl);
132 if (cfdata->bg) 128 eina_stringshare_del(cfdata->bg);
133 E_FREE(cfdata->bg);
134 if (cfdata->name) 129 if (cfdata->name)
135 E_FREE(cfdata->name); 130 E_FREE(cfdata->name);
136#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8) 131#if (ECORE_VERSION_MAJOR > 1) || (ECORE_VERSION_MINOR >= 8)
@@ -145,10 +140,11 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
145{ 140{
146 char name[40]; 141 char name[40];
147 142
148 if (!cfdata->name[0]) 143 if ((!cfdata->name) || (!cfdata->name[0]))
149 { 144 {
150 snprintf(name, sizeof(name), _(e_config->desktop_default_name), 145 snprintf(name, sizeof(name), _(e_config->desktop_default_name),
151 cfdata->desk_x, cfdata->desk_y); 146 cfdata->desk_x, cfdata->desk_y);
147 free(cfdata->name);
152 cfdata->name = strdup(name); 148 cfdata->name = strdup(name);
153 } 149 }
154 150
@@ -254,8 +250,7 @@ _cb_bg_change(void *data, int type, void *event)
254 250
255 file = e_bg_file_get(cfdata->con_num, cfdata->zone_num, 251 file = e_bg_file_get(cfdata->con_num, cfdata->zone_num,
256 cfdata->desk_x, cfdata->desk_y); 252 cfdata->desk_x, cfdata->desk_y);
257 E_FREE(cfdata->bg); 253 eina_stringshare_replace(&cfdata->bg, file);
258 cfdata->bg = strdup(file);
259 e_widget_preview_edje_set(cfdata->preview, cfdata->bg, 254 e_widget_preview_edje_set(cfdata->preview, cfdata->bg,
260 "e/desktop/background"); 255 "e/desktop/background");
261 256