Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Commit

Permalink
Fixed navbar colorized installation (closes #34)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeatMonster committed Aug 23, 2018
1 parent 5431459 commit c84caa8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion idarling/interface/painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,22 @@ def install(self):
"""
class UIHooks(ida_kernwin.UI_Hooks):
def __init__(self, painter):
self._painter = painter
ida_kernwin.UI_Hooks.__init__(self)
self._painter = painter
self._initialized = False

def database_inited(self, is_new_database, idc_script):
self._install_nvar_colorizer()
self._initialized = True
return 0

def ready_to_run(self, *_):
if not self._initialized:
self._install_nvar_colorizer()
self._initialized = False
return 0

def _install_nvar_colorizer(self):
"""
We must get the original ida colorizer only one time to avoid
segfault.
Expand All @@ -100,6 +112,7 @@ def ready_to_run(self, *_):
colorizer = self._painter.custom_nav_colorizer
ida_nav_colorizer = ida_kernwin.set_nav_colorizer(colorizer)
self._painter.ida_nav_colorizer = ida_nav_colorizer
self._uiHooks.unhook()

self._uiHooks = UIHooks(self)
result = self._uiHooks.hook()
Expand Down

0 comments on commit c84caa8

Please sign in to comment.