Skip to content

Commit abdbeea

Browse files
committed
Ensure that we remove the AfterCompiledHook also if the panel is already closed
1 parent 3405211 commit abdbeea

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

procedures/CodeBrowser_hooks.ipf

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,19 @@
99
static Function IgorStartOrNewHook(igorApplicationNameStr)
1010
string igorApplicationNameStr
1111

12-
DoWindow $GetPanel()
13-
if(V_flag == 0)
14-
return 0
15-
endif
16-
1712
setHooksAndUpdate()
1813
return 0
1914
End
2015

2116
static Function IgorQuitHook(igorApplicationNameStr)
2217
string igorApplicationNameStr
23-
24-
DoWindow $GetPanel()
25-
if(V_flag == 0)
26-
return 0
27-
endif
2818

2919
preparePanelClose()
3020
return 0
3121
End
3222

3323
static Function IgorBeforeNewHook(igorApplicationNameStr)
3424
string igorApplicationNameStr
35-
36-
DoWindow $GetPanel()
37-
if(V_flag == 0)
38-
return 0
39-
endif
4025

4126
preparePanelClose()
4227
return 0
@@ -47,21 +32,28 @@ Function setHooksAndUpdate()
4732

4833
// prevent multiple hooks of the same function
4934
SetIgorHook/K AfterCompiledHook=updatePanel
35+
5036
SetIgorHook AfterCompiledHook=updatePanel
37+
debugprint("SetIgorHook AfterCompiledHook: " + S_info)
5138
updatePanel()
5239
End
5340

5441
// Prepare for panel closing, must be called before the panel is killed or the experiment closed
5542
Function preparePanelClose()
56-
SetIgorHook/K AfterCompiledHook = updatePanel
43+
SetIgorHook/K AfterCompiledHook=updatePanel
44+
debugprint("SetIgorHook AfterCompiledHook: " + S_info)
45+
46+
DoWindow $GetPanel()
47+
if(V_flag == 0)
48+
return 0
49+
endif
5750

5851
// save panel coordinates to disk
5952
STRUCT CodeBrowserPrefs prefs
6053
FillPackagePrefsStruct(prefs)
6154
SavePackagePrefsToDisk(prefs)
6255
End
6356

64-
// Window hook for the panel, removes the AfterCompiledHook on panel close and saves the panel coordinates
6557
Function panelHook(s)
6658
STRUCT WMWinHookStruct &s
6759

0 commit comments

Comments
 (0)