diff --git a/src/history_window.py b/src/history_window.py
index 04d817191727c00a87d13b5a1f9d82a2670f2757..4153b7bab75f114c9c5464f6dcc0e7f4b7e56c49 100644
--- a/src/history_window.py
+++ b/src/history_window.py
@@ -88,6 +88,10 @@ class HistoryWindow:
 		self.window.show_all()
 
 	def on_history_window_destroy(self, widget):
+		if self.mark_days_idle_call_id:
+			# if user destroys the window, and we have a generator filling mark days
+			# stop him!
+			gobject.source_remove(self.mark_days_idle_call_id)
 		del gajim.interface.instances['logs'][self.jid]
 
 	def on_close_button_clicked(self, widget):