It seems that my dbgp plugin tends to hang NPP from time to time. The hang happens when I close NPP. It also only happens when the main window of the plugin was opened. It has probably something to do with all the threads that are spawned by Delphi components. I have been able to catch it a few times, but couldn't figure out if the problem was in my code (or some Delphi message processing loop) or the NPP code.
There are two things I wanted to write about:
1. Compilation problems and errors while running
I use MSVC++ .NET (2003).
I downloaded npp.4.2.src and later the SVN version. Both had same problems. The first problem was, that I was unable to link PowerEditor. A missing reference to "ColumnEditorDlg::run_dlgProc". I had to add columnEditor.cpp and columnEditor.h files to the Notepad++ project. Sorry if this was pointed out earlier, but I did not find anything in the forums.
I then managed to compile Scintilla and NPP without problems. I dropped the Scintilla.dll and SciLexer.dll along with some other .xml files in the Debug directory so I could run NPP from the IDE. NPP executed without problems, but when I closed it (file/exit) an exception was raised.
ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c95db9c()
ntdll.dll!7c96cd11()
ntdll.dll!7c960af8()
> notepadPlus_Debug.exe!std::_Construct<PlugingDlgDockingInfo,PlugingDlgDockingInfo>(PlugingDlgDockingInfo * _Ptr=0x003f0000, const PlugingDlgDockingInfo & _Val={...}) Line 42 + 0xe C++
kernel32.dll!7c85e9cf()
notepadPlus_Debug.exe!_CrtIsValidHeapPointer(const void * pUserData=0x00af8b48) Line 1807 C
notepadPlus_Debug.exe!_free_dbg(void * pUserData=0x00af8b48, int nBlockUse=0x00000001) Line 1132 + 0x9 C
notepadPlus_Debug.exe!operator delete(void * pUserData=0x00af8b48) Line 54 + 0x10 C++
notepadPlus_Debug.exe!std::allocator<FloatingWindowInfo>::deallocate(FloatingWindowInfo * _Ptr=0x00af8b48, unsigned int __formal=0x000ccccd) Line 132 + 0x9 C++
notepadPlus_Debug.exe!std::vector<FloatingWindowInfo,std::allocator<FloatingWindowInfo> >::_Tidy() Line 797 C++
notepadPlus_Debug.exe!std::vector<FloatingWindowInfo,std::allocator<FloatingWindowInfo> >::~vector<FloatingWindowInfo,std::allocator<FloatingWindowInfo> >() Line 389 C++
notepadPlus_Debug.exe!Notepad_plus::saveDockingParams() Line 298 + 0x18 C++
notepadPlus_Debug.exe!Notepad_plus::saveGUIParams() Line 194 C++
notepadPlus_Debug.exe!Notepad_plus::runProc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000010, unsigned int wParam=0x00000000, long lParam=0x00000000) Line 6666 C++
notepadPlus_Debug.exe!Notepad_plus::Notepad_plus_Proc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000010, unsigned int wParam=0x00000000, long lParam=0x00000000) Line 6949 C++
user32.dll!77d48734()
user32.dll!77d48816()
user32.dll!77d4b4c0()
user32.dll!77d4b50c()
ntdll.dll!7c90eae3()
user32.dll!77d494be()
user32.dll!77d4b42d()
user32.dll!77d4d598()
user32.dll!77d4baa4()
user32.dll!77d4b96b()
user32.dll!77d4d598()
uxtheme.dll!5ad73c20()
uxtheme.dll!5ad8e300()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad7367a()
uxtheme.dll!5ad8e2d5()
user32.dll!77d5f134()
user32.dll!77d4d559()
notepadPlus_Debug.exe!Notepad_plus::runProc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000112, unsigned int wParam=0x0000f060, long lParam=0x002f02f2) Line 6695 + 0x16 C++
notepadPlus_Debug.exe!Notepad_plus::Notepad_plus_Proc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000112, unsigned int wParam=0x0000f060, long lParam=0x002f02f2) Line 6949 C++
user32.dll!77d48734()
user32.dll!77d48816()
uxtheme.dll!5ad74301()
user32.dll!77d4b4c0()
user32.dll!77d4b50c()
ntdll.dll!7c90eae3()
user32.dll!77d494be()
user32.dll!77d4d4e4()
user32.dll!77d4b903()
uxtheme.dll!5ad9881f()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad7367a()
user32.dll!77d5f134()
notepadPlus_Debug.exe!Notepad_plus::runProc(HWND__ * hwnd=0x00240738, unsigned int Message=0x000000a1, unsigned int wParam=0x00000014, long lParam=0x002f02f2) Line 6908 + 0x16 C++
notepadPlus_Debug.exe!Notepad_plus::Notepad_plus_Proc(HWND__ * hwnd=0x00240738, unsigned int Message=0x000000a1, unsigned int wParam=0x00000014, long lParam=0x002f02f2) Line 6949 C++
user32.dll!77d48734()
user32.dll!77d48816()
user32.dll!77d4ec03()
user32.dll!77d489cd()
ntdll.dll!7c915b4f()
user32.dll!77d51091()
user32.dll!77d496c7()
notepadPlus_Debug.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, char * lpszCmdLine=0x00151f2d, int nCmdShow=0x00000001) Line 282 + 0xa C++
notepadPlus_Debug.exe!WinMainCRTStartup() Line 251 + 0x30 C
kernel32.dll!7c816fd7()
ntdll.dll!7c915b4f()
With a bit of poking around I managed to gather this info so far:
When exitin saveDockingParams (notepadPlus_Debug.exe!Notepad_plus::saveDockingParams() Line 298 + 0x18) two local variables cause problems:
-vFloatingWindowInfo
-vPluginDockInfo
Tell me if you need more.
2. Plugin closing related problems
The other thing I discovered while "optimizing" my plugin, that when the DLL_PROCESS_DETACH is called, the NPP main window handler is already gone. This can cause problems if the plugin need the NPP window handler.
I suggest implementing another plugin function call (similar to setInfo, getName...) like "destroyPlugin", that would get called before the main window handle is freed.
Best regards...
-Zobo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Don, all.
It seems that my dbgp plugin tends to hang NPP from time to time. The hang happens when I close NPP. It also only happens when the main window of the plugin was opened. It has probably something to do with all the threads that are spawned by Delphi components. I have been able to catch it a few times, but couldn't figure out if the problem was in my code (or some Delphi message processing loop) or the NPP code.
There are two things I wanted to write about:
1. Compilation problems and errors while running
I use MSVC++ .NET (2003).
I downloaded npp.4.2.src and later the SVN version. Both had same problems. The first problem was, that I was unable to link PowerEditor. A missing reference to "ColumnEditorDlg::run_dlgProc". I had to add columnEditor.cpp and columnEditor.h files to the Notepad++ project. Sorry if this was pointed out earlier, but I did not find anything in the forums.
I then managed to compile Scintilla and NPP without problems. I dropped the Scintilla.dll and SciLexer.dll along with some other .xml files in the Debug directory so I could run NPP from the IDE. NPP executed without problems, but when I closed it (file/exit) an exception was raised.
ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c95db9c()
ntdll.dll!7c96cd11()
ntdll.dll!7c960af8()
> notepadPlus_Debug.exe!std::_Construct<PlugingDlgDockingInfo,PlugingDlgDockingInfo>(PlugingDlgDockingInfo * _Ptr=0x003f0000, const PlugingDlgDockingInfo & _Val={...}) Line 42 + 0xe C++
kernel32.dll!7c85e9cf()
notepadPlus_Debug.exe!_CrtIsValidHeapPointer(const void * pUserData=0x00af8b48) Line 1807 C
notepadPlus_Debug.exe!_free_dbg(void * pUserData=0x00af8b48, int nBlockUse=0x00000001) Line 1132 + 0x9 C
notepadPlus_Debug.exe!operator delete(void * pUserData=0x00af8b48) Line 54 + 0x10 C++
notepadPlus_Debug.exe!std::allocator<FloatingWindowInfo>::deallocate(FloatingWindowInfo * _Ptr=0x00af8b48, unsigned int __formal=0x000ccccd) Line 132 + 0x9 C++
notepadPlus_Debug.exe!std::vector<FloatingWindowInfo,std::allocator<FloatingWindowInfo> >::_Tidy() Line 797 C++
notepadPlus_Debug.exe!std::vector<FloatingWindowInfo,std::allocator<FloatingWindowInfo> >::~vector<FloatingWindowInfo,std::allocator<FloatingWindowInfo> >() Line 389 C++
notepadPlus_Debug.exe!Notepad_plus::saveDockingParams() Line 298 + 0x18 C++
notepadPlus_Debug.exe!Notepad_plus::saveGUIParams() Line 194 C++
notepadPlus_Debug.exe!Notepad_plus::runProc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000010, unsigned int wParam=0x00000000, long lParam=0x00000000) Line 6666 C++
notepadPlus_Debug.exe!Notepad_plus::Notepad_plus_Proc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000010, unsigned int wParam=0x00000000, long lParam=0x00000000) Line 6949 C++
user32.dll!77d48734()
user32.dll!77d48816()
user32.dll!77d4b4c0()
user32.dll!77d4b50c()
ntdll.dll!7c90eae3()
user32.dll!77d494be()
user32.dll!77d4b42d()
user32.dll!77d4d598()
user32.dll!77d4baa4()
user32.dll!77d4b96b()
user32.dll!77d4d598()
uxtheme.dll!5ad73c20()
uxtheme.dll!5ad8e300()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad7367a()
uxtheme.dll!5ad8e2d5()
user32.dll!77d5f134()
user32.dll!77d4d559()
notepadPlus_Debug.exe!Notepad_plus::runProc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000112, unsigned int wParam=0x0000f060, long lParam=0x002f02f2) Line 6695 + 0x16 C++
notepadPlus_Debug.exe!Notepad_plus::Notepad_plus_Proc(HWND__ * hwnd=0x00240738, unsigned int Message=0x00000112, unsigned int wParam=0x0000f060, long lParam=0x002f02f2) Line 6949 C++
user32.dll!77d48734()
user32.dll!77d48816()
uxtheme.dll!5ad74301()
user32.dll!77d4b4c0()
user32.dll!77d4b50c()
ntdll.dll!7c90eae3()
user32.dll!77d494be()
user32.dll!77d4d4e4()
user32.dll!77d4b903()
uxtheme.dll!5ad9881f()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad7367a()
user32.dll!77d5f134()
notepadPlus_Debug.exe!Notepad_plus::runProc(HWND__ * hwnd=0x00240738, unsigned int Message=0x000000a1, unsigned int wParam=0x00000014, long lParam=0x002f02f2) Line 6908 + 0x16 C++
notepadPlus_Debug.exe!Notepad_plus::Notepad_plus_Proc(HWND__ * hwnd=0x00240738, unsigned int Message=0x000000a1, unsigned int wParam=0x00000014, long lParam=0x002f02f2) Line 6949 C++
user32.dll!77d48734()
user32.dll!77d48816()
user32.dll!77d4ec03()
user32.dll!77d489cd()
ntdll.dll!7c915b4f()
user32.dll!77d51091()
user32.dll!77d496c7()
notepadPlus_Debug.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, char * lpszCmdLine=0x00151f2d, int nCmdShow=0x00000001) Line 282 + 0xa C++
notepadPlus_Debug.exe!WinMainCRTStartup() Line 251 + 0x30 C
kernel32.dll!7c816fd7()
ntdll.dll!7c915b4f()
With a bit of poking around I managed to gather this info so far:
When exitin saveDockingParams (notepadPlus_Debug.exe!Notepad_plus::saveDockingParams() Line 298 + 0x18) two local variables cause problems:
-vFloatingWindowInfo
-vPluginDockInfo
Tell me if you need more.
2. Plugin closing related problems
The other thing I discovered while "optimizing" my plugin, that when the DLL_PROCESS_DETACH is called, the NPP main window handler is already gone. This can cause problems if the plugin need the NPP window handler.
I suggest implementing another plugin function call (similar to setInfo, getName...) like "destroyPlugin", that would get called before the main window handle is freed.
Best regards...
-Zobo