Fix to avoid calling signal_block off of hte main thread

This commit is contained in:
ridiculousfish 2012-02-18 23:26:39 -08:00
parent ca1c8243c8
commit d8a9991738
6 changed files with 15 additions and 5 deletions

View file

@ -50,6 +50,7 @@
#include "event.h"
#include "path.h"
#include "history.h"
#include "highlight.h"
/**
The number of tests to run
@ -552,6 +553,11 @@ static void test_colors()
assert(rgb_color_t(L"mooganta").is_none());
}
/* Testing autosuggestion */
static void test_autosuggest() {
bool autosuggest_handle_special(const wcstring &str, const wcstring &working_directory, bool *outSuggestionOK);
}
/**
Test speed of completion calculations
@ -734,6 +740,7 @@ int main( int argc, char **argv )
test_expand();
test_path();
test_colors();
test_autosuggest();
history_tests_t::test_history();
say( L"Encountered %d errors in low-level tests", err_count );

View file

@ -528,7 +528,7 @@ static int has_expand_reserved( const wchar_t *str )
return 0;
}
bool autosuggest_handle_special(const wcstring &str, const env_vars &vars, const wcstring &working_directory, bool *outSuggestionOK) {
bool autosuggest_handle_special(const wcstring &str, const wcstring &working_directory, bool *outSuggestionOK) {
ASSERT_IS_BACKGROUND_THREAD();
assert(outSuggestionOK != NULL);

View file

@ -106,7 +106,7 @@ void highlight_universal( const wchar_t *buff, int *color, int pos, wcstring_lis
*/
rgb_color_t highlight_get_color( int highlight, bool is_background );
bool autosuggest_handle_special(const wcstring &str, const env_vars &vars, const wcstring &working_directory, bool *outSuggestionOK);
bool autosuggest_handle_special(const wcstring &str, const wcstring &working_directory, bool *outSuggestionOK);
#endif

View file

@ -404,7 +404,8 @@ void history_t::load_old_if_needed(void)
int fd;
int ok=0;
signal_block();
// PCA not sure why signals were blocked here
//signal_block();
wcstring filename = history_filename(name, L"");
if( ! filename.empty() )
@ -427,7 +428,7 @@ void history_t::load_old_if_needed(void)
close( fd );
}
}
signal_unblock();
//signal_unblock();
}
void history_search_t::skip_matches(const wcstring_list_t &skips) {

View file

@ -1287,7 +1287,7 @@ struct autosuggestion_context_t {
while (searcher.go_backwards()) {
history_item_t item = searcher.current_item();
bool item_ok = false;
if (autosuggest_handle_special(item.str(), vars, working_directory, &item_ok)) {
if (autosuggest_handle_special(item.str(), working_directory, &item_ok)) {
/* The command autosuggestion was handled specially, so we're done */
} else {
/* See if the item has any required paths */

View file

@ -633,6 +633,7 @@ void signal_handle( int sig, int do_handle )
void signal_block()
{
ASSERT_IS_MAIN_THREAD();
sigset_t chldset;
if( !block_count )
@ -647,6 +648,7 @@ void signal_block()
void signal_unblock()
{
ASSERT_IS_MAIN_THREAD();
sigset_t chldset;
block_count--;