Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fixed NppExec plugin does not allow TCEdit.exe to close properly

Aug
2,799
144
Code:
R:\>whatver
     _x64: 1
   _admin: 1
_elevated: 1

TCC  36.50.68 x64   Windows 10 [Version 10.0.19045.7417]
BuildNumber  Caption                   CSDVersion  OSArchitecture  Version
19045        Microsoft Windows 10 Pro              64-bit          10.0.19045

22H2


NppExec plugin does not allow TCEdit.exe to close properly.

1782813408553.webp


1782813417220.webp


1782813423889.webp


The NppExec plugin works as it should,
that is,
it allows me to run a .btm from within TCEdit.exe,
with output being displayed in the NppExec Console.

Exiting TCEdit.exe does not result in TCEdit.exe being closed.

Code:
R:\>if isapp tcedit.exe echo Yes
Yes

R:\>tcedit.exe

R:\>taskend /f tcedit*

R:\>if isapp tcedit.exe echo Yes

Attempting to launch TCEdit.exe after I have closed it,
does not launch TCEdit.exe,
as it is still in memory,
and must be ended forcefully.

Joe
 
Still not working in build 69.

Code:
E:\Utils>ver

TCC  36.50.69 x64   Windows 10 [Version 10.0.19045.7417]

E:\Utils>tcedit.exe

E:\Utils>if isapp tcedit.exe echo Yes
Yes

E:\Utils>taskend /f tcedit*

E:\Utils>if isapp tcedit.exe echo Yes

E:\Utils>

Joe
 
I should add that it is "fixed" if one does not run an NppExec script.

That is, with the NppExec plugin loaded,
exiting TCEdit.exe does not leave TCEdit.exe in memory.

If I run an NppExec script,
exit TCEdit.exe,
then TCEdit.exe remains in memory,
and I have to use Taskend /f tcedit* to remove it from memory.

Joe
 
Execute any NppExec script and it causes TCEdit.exe not to exit properly.

Did you try the NppExec script that I provided in my OP?

Code:
NPP_CONSOLE 1
NPP_SAVE
set local TCCRT=C:\Program Files\JPSoft\TCC_RT_36\TCC.EXE
"$(TCCRT)" /q "$(FULL_CURRENT_PATH)

Joe
 
This is my work-around for now;

Code:
@SETLOCAL
@ECHO OFF

:: This works with Options -> Single Instance Enabled
iff isapp tcedit.exe then
  iff isvisible *tcedit* then
    start tcedit.exe %$
  else
    taskend /f tcedit*
    start tcedit.exe %$
  endiff
else
  start tcedit.exe %$
endiff
ENDLOCAL

Joe
 
TCC 36.50.70 x64 Windows 10 [Version 10.0.19045.7417]
Launch TCEdit.exe with NppExec Plugin loaded,
no NppExec Script executed,
exit TCEdit.exe
Code:
R:\>tcedit.exe r:\test.btm

R:\>if isapp tcedit.exe echo Yes

R:\>if isvisible *tcedit* echo Yes

Works as it should.

Launch TCEdit.exe with NppExec Plugin loaded,
NppExec Script executed,
exit TCEdit.exe
Code:
R:\>tcedit.exe r:\test.btm

R:\>if isapp tcedit.exe echo Yes

R:\>if isvisible *tcedit* echo Yes

Works as it should.

Thankyou Rex.

If I may,
what was causing TCEdit.exe to not close properly,
when an NppExec Script had been executed?

Joe
 
what was causing TCEdit.exe to not close properly,
when an NppExec Script had been executed?

NppExec creates a background thread the first time it runs a script. But NppExec does not clean up the thread when it is notified that the plugin is being shut down.

When TCEdit exited, the following sequence was executed:

1. OnClose() → NotifyShutdownWindowAlive() → beNotified(NPPN_SHUTDOWN) runs synchronously and correctly tears down NppExec's state. The BackgroundExecuteThread is still running, blocked on WaitForMultipleObjects waiting for either Stop or a new command.
2. UnloadPlugins() → m_plugins.RemoveAll() — DLL stays loaded, no FreeLibrary.
3. Window destroyed → message loop exits → ExitInstance() → CRT calls ExitProcess().
4. ExitProcess() force-terminates all threads first — including BackgroundExecuteThread,.
5. ExitProcess() then runs DLL_PROCESS_DETACH under the loader lock → globalUninitialize() → Uninit() → Stop() → m_ExecuteThreadDoneEvent.Wait(INFINITE) on an event that will never be signalled — permanent hang.
 
Back
Top