Work-around for detecting end of file, hopefully fixing #518.
This commit is contained in:
@@ -130,7 +130,6 @@ static void async_read_callback ( GObject *source_object, GAsyncResult *res, gpo
|
|||||||
if ( data != NULL ) {
|
if ( data != NULL ) {
|
||||||
// Absorb separator, already in buffer so should not block.
|
// Absorb separator, already in buffer so should not block.
|
||||||
g_data_input_stream_read_byte ( stream, NULL, NULL );
|
g_data_input_stream_read_byte ( stream, NULL, NULL );
|
||||||
|
|
||||||
read_add ( pd, data, len );
|
read_add ( pd, data, len );
|
||||||
g_free ( data );
|
g_free ( data );
|
||||||
rofi_view_reload ();
|
rofi_view_reload ();
|
||||||
@@ -138,6 +137,22 @@ static void async_read_callback ( GObject *source_object, GAsyncResult *res, gpo
|
|||||||
g_data_input_stream_read_upto_async ( pd->data_input_stream, &( pd->separator ), 1, G_PRIORITY_LOW, pd->cancel,
|
g_data_input_stream_read_upto_async ( pd->data_input_stream, &( pd->separator ), 1, G_PRIORITY_LOW, pd->cancel,
|
||||||
async_read_callback, pd );
|
async_read_callback, pd );
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
GError *error = NULL;
|
||||||
|
// Absorb separator, already in buffer so should not block.
|
||||||
|
// If error == NULL end of stream..
|
||||||
|
g_data_input_stream_read_byte ( stream, NULL, &error);
|
||||||
|
if ( error == NULL ) {
|
||||||
|
// Add empty line.
|
||||||
|
read_add ( pd, "", 0);
|
||||||
|
rofi_view_reload ();
|
||||||
|
|
||||||
|
g_data_input_stream_read_upto_async ( pd->data_input_stream, &( pd->separator ), 1, G_PRIORITY_LOW, pd->cancel,
|
||||||
|
async_read_callback, pd );
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( !g_cancellable_is_cancelled ( pd->cancel ) ) {
|
if ( !g_cancellable_is_cancelled ( pd->cancel ) ) {
|
||||||
// Hack, don't use get active.
|
// Hack, don't use get active.
|
||||||
|
Reference in New Issue
Block a user