about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/ext/img_display.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 569d03a9..3eaa0b20 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -187,6 +187,9 @@ class W3MImageDisplayer(ImageDisplayer, FileManagerAware):
             self.initialize()
         input_gen = self._generate_w3m_input(path, start_x, start_y, width,
                                              height)
+        self.process.stdin.write(input_gen)
+        self.process.stdin.flush()
+        self.process.stdout.readline()
 
         # Mitigate the issue with the horizontal black bars when
         # selecting some images on some systems. 2 milliseconds seems
@@ -195,11 +198,10 @@ class W3MImageDisplayer(ImageDisplayer, FileManagerAware):
             from time import sleep
             sleep(self.fm.settings.w3m_delay)
 
-        self.process.stdin.write(input_gen)
-        self.process.stdin.flush()
-        self.process.stdout.readline()
+        #HACK workaround for w3mimgdisplay memory leak
         self.quit()
         self.is_initialized = False
+        #HACK
 
     def clear(self, start_x, start_y, width, height):
         if not self.is_initialized or self.process.poll() is not None: