fix of regression, no longer crashes on resizing window
This commit is contained in:
+5
-4
@@ -338,7 +338,7 @@ void *thread_top(){
|
|||||||
}
|
}
|
||||||
void *thread_btm(){
|
void *thread_btm(){
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
char *ui_btm_right_block = malloc(sizeof(char));
|
char *ui_btm_right_block = NULL;
|
||||||
char fmt[] = "%0.2lf%c %s %0.2lf%c %s"; /*using a pointer here would put it into ROM, causing a segfault at the edit below*/
|
char fmt[] = "%0.2lf%c %s %0.2lf%c %s"; /*using a pointer here would put it into ROM, causing a segfault at the edit below*/
|
||||||
unsigned int ui_btm_right_block_size = 0;
|
unsigned int ui_btm_right_block_size = 0;
|
||||||
unsigned int buffer_width = 0;
|
unsigned int buffer_width = 0;
|
||||||
@@ -370,7 +370,6 @@ void *thread_btm(){
|
|||||||
pthread_mutex_unlock(&mutex_mid);
|
pthread_mutex_unlock(&mutex_mid);
|
||||||
|
|
||||||
|
|
||||||
free(ui_btm_right_block);
|
|
||||||
|
|
||||||
if(path) {
|
if(path) {
|
||||||
free(path);
|
free(path);
|
||||||
@@ -418,9 +417,11 @@ void *thread_btm(){
|
|||||||
} else {
|
} else {
|
||||||
fmt[15] = '2';
|
fmt[15] = '2';
|
||||||
}
|
}
|
||||||
ui_btm_right_block = malloc(ui_btm_right_block_size * 2);
|
free(ui_btm_right_block);
|
||||||
ui_btm_right_block_size = sprintf(ui_btm_right_block, fmt, parsed_number[0], size_unit[(unsigned)size_index[0]], ui_btm_current_dir_size, parsed_number[1], size_unit[(unsigned)size_index[1]], ui_btm_text_storage_left);
|
ui_btm_right_block = malloc(buffer_width);
|
||||||
|
ui_btm_right_block_size = snprintf(ui_btm_right_block, buffer_width, fmt, parsed_number[0], size_unit[(unsigned)size_index[0]], ui_btm_current_dir_size, parsed_number[1], size_unit[(unsigned)size_index[1]], ui_btm_text_storage_left);
|
||||||
/*}}}*/
|
/*}}}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(btm_buffer, ' ', buffer_width);
|
memset(btm_buffer, ' ', buffer_width);
|
||||||
|
|||||||
Reference in New Issue
Block a user