reset filter only after cancelling the search
Fixes issue where the UI froze when removing the last char of a query while still a search was running. This caused the search thread to append to the newly truncated file, resulting in megabytes of null bytes at the beginning.
This commit is contained in:
@@ -43,11 +43,6 @@ class FilterTask(QRunnable):
|
||||
# print("starting thread ", threading.currentThread())
|
||||
self.on_before()
|
||||
|
||||
# delay the filtering. This work arounds a race condition. For some reasons, even though we have locks
|
||||
# to ensure that only one thread writes to the target file, it happened that the file was not correctly
|
||||
# truncated and started with null bytes. Sometimes several MB of null bytes. My guess is that this is
|
||||
# caused by async write operations.
|
||||
time.sleep(0.5)
|
||||
if self.aborted:
|
||||
self.on_finish()
|
||||
|
||||
@@ -83,7 +78,7 @@ class FilterTask(QRunnable):
|
||||
break
|
||||
finally:
|
||||
self.on_finish()
|
||||
#print("dome thread ", threading.currentThread())
|
||||
# print("dome thread ", threading.currentThread())
|
||||
|
||||
|
||||
class FilterWidget(QWidget):
|
||||
@@ -160,13 +155,14 @@ class FilterWidget(QWidget):
|
||||
query = self.query_field.text()
|
||||
ignore_case = self.ignore_case.isChecked()
|
||||
is_regex = self.is_regex.isChecked()
|
||||
if len(query) == 0:
|
||||
self.reset_filter()
|
||||
return
|
||||
|
||||
# cancel previous search
|
||||
self._cancel_search()
|
||||
|
||||
if len(query) == 0:
|
||||
self.reset_filter()
|
||||
return
|
||||
|
||||
try:
|
||||
flags = re.IGNORECASE if ignore_case else 0
|
||||
if is_regex:
|
||||
|
||||
Reference in New Issue
Block a user