Pane right click hangs and crashes [solved]

Found a bug or something that needs fixing?
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Pane right click hangs and crashes [solved]

Post by twinsen »

In revision 159 (win xp 32bit):

Open a directory containing files.
Right click on the pane, eg on a blank part of a "type" cell of a file.
Explorer++ hangs.
This does not happen in 1.2. In 1.2 it has a context menu starting with "View".

Open a directory containing subdirectories.
Right click on the pane, eg on a blank part of a "type" cell of a folder.
Explorer++ crashes.
This does not happen in 1.2. In 1.2 it has a context menu starting with "View".
Last edited by twinsen on Sat Jan 15, 2011 6:52 pm, edited 3 times in total.
ajs
Posts: 409
Joined: Mon Jul 05, 2010 6:37 pm

Re: Pane right click hangs and crashes

Post by ajs »

hi twinsen,
i tried what you said using commit 159 (without any patch). doesn't hang on my system (win 7 x64). I R-clicked on the "type" column, both empty and full lines. i also tried other several columns.
maybe in debug mode you can find where it hangs on your system.

By the way, David has started to commit our changes. I am re-working each patch to create individual patch again commit 159, to make it easier for David to check each one. I hope within tomorrow to be able to finish them all.
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Re: Pane right click hangs and crashes

Post by twinsen »

It crashes in Explorer++\Helper\CustomMenu.cpp
Here:

Code: Select all

			if(pcmi->bUseImage)
			{
				ImageList_Draw(himlMenu,pcmi->iImage,pDrawItem->hDC,
					pDrawItem->rcItem.left + MENU_ICON_INDENT_LEFT,
					pDrawItem->rcItem.top + MENU_ICON_INDENT_TOP,ILD_NORMAL);
			}
pcmi is NULL for some reason

Changing to this stops the crash, but now the context menu look strange.

Code: Select all

			CustomMenuInfo_t *pcmi = NULL;

			pcmi = (CustomMenuInfo_t *)mi.dwItemData;

			if(pcmi && pcmi->bUseImage)
			{
				ImageList_Draw(himlMenu,pcmi->iImage,pDrawItem->hDC,
					pDrawItem->rcItem.left + MENU_ICON_INDENT_LEFT,
					pDrawItem->rcItem.top + MENU_ICON_INDENT_TOP,ILD_NORMAL);
			}
v159_RightClickCrash.png
v159_RightClickCrash.png (4.79 KiB) Viewed 13672 times
Compared to version 1.2 that looks fine.
1p2_RightClick_OK.png
1p2_RightClick_OK.png (4.33 KiB) Viewed 13674 times
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Re: Pane right click hangs and crashes

Post by twinsen »

Perhaps the code in revision 161 only works on windows 7, but the 1.2 code works for xp and windows 7?
I tried throwing away the revision 161 right click code and porting over the code from 1.2.
I got this far.
RightPlaceHolder1.png
RightPlaceHolder1.png (3.24 KiB) Viewed 13649 times
RightPlaceHolder2.png
RightPlaceHolder2.png (2.74 KiB) Viewed 13650 times
The icons disappeared.
The view and new menus are just placeholders. Any idea how to get them populated like in 1.2?
All the other menu items work though, the size is right, and there is no weird git stuff.
ajs
Posts: 409
Joined: Mon Jul 05, 2010 6:37 pm

Re: Pane right click hangs and crashes

Post by ajs »

Hi twinsen,
about the "view" r-click menu, I have already fixed the problem in patch_04 (which is waiting for commitment by David).
About the "new" r-click menu, I have no issue: it works fine on my computer (win 7 x64).
can you try out this cumulative patch (http://www.explorerplusplus.com/forum/v ... ?f=7&t=639) and check if you still have the problem?
be aware that the "bookmark all tabs" doesn't save the "sessions" (as per your patch) but simply bookmarks all open tabs.
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Re: Pane right click hangs and crashes

Post by twinsen »

The patch made no difference.
This is what right clicking does with the patch.
161WithPatch.png
161WithPatch.png (29.32 KiB) Viewed 13639 times
Till this bug is fixed I have to keep using and maintaining a 1.2 source branch. I use the right click new menu a lot. Maybe if I get win7 installed on every computer I use then I wont be affected by the bug anymore.
ajs
Posts: 409
Joined: Mon Jul 05, 2010 6:37 pm

Re: Pane right click hangs and crashes

Post by ajs »

Hi twinsen,
perhaps here is a thing you can try.
Starting from commit 143 (which is v1.2) you can checkout and try the different versions committed to the repository until you find the one which causes the problem. For example if you find that commit 149 hangs E++ but 148 doesn't, then we know where to look for.
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Re: Pane right click hangs and crashes

Post by twinsen »

Revision 145 introduced the bug.
The log says "- Context menu extensions are now shown on the background right click menu.
- Default focus in the search dialog is now set to the name field, rather than the directory field."
Is there somewhere I can disable importing context menu extensions? Maybe it tries to import them from the registry.
ajs
Posts: 409
Joined: Mon Jul 05, 2010 6:37 pm

Re: Pane right click hangs and crashes

Post by ajs »

twinsen wrote:Revision 145 introduced the bug.
The log says "- Context menu extensions are now shown on the background right click menu.
- Default focus in the search dialog is now set to the name field, rather than the directory field."
Is there somewhere I can disable importing context menu extensions? Maybe it tries to import them from the registry.
Hi twinsen,
I didn't check the changes between 144 and 145 but my guess is that with 145 the right-click menu shows some of the entries taken from the windows registry file (some entries or the right click menu are defined by E++, others are "taken" from the OS.
I think the best thing you can do is this:
1) compile 145 with debug option
2) run the executable in debug mode within Visual studio
3) put a breakpoint in the code which handles the right-click menu (search for "OnRightClick") and then follow the code step-by-step to find where it crashes.
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Re: Pane right click hangs and crashes

Post by twinsen »

The crash would have happened here (as indicated in previous posts):

Code: Select all

         pcmi = (CustomMenuInfo_t *)mi.dwItemData;

         if(pcmi && pcmi->bUseImage)  //changing to "if (pcmi &&" stops the crash
         {
Stopping the crash then leaves a strange "big" context menu with extra "tortoise git" stuff. By getting rid of the stuff that parses the registry (there is one function that loads stuff from a "background" registry key), we are left with a context menu that has no icons and a place holder view menu and no new menu (everything else works). I noticed the old icon code has been commented out revisions >=145 with a TODO comment, so its understandable they no longer appear (refactoring obviously was unfinished). But then the problem becomes trying to re-implement the new and view menus from revision <=144. There was lots of changes. I've been trying to find the new/view code. Next step I might try is commenting out 144 code until the new / view menus disappear (searching for keywords doesn't seem to help me find it). Then after it all works, we probably need to put the code that loads extensions from the registry back in, since I assume it works fine in win7 (it can be an option you disable for xp).

Understanding how it works might be useful, as typically on a slow computer there are lots of handlers. Eg I used to disable tortoise svn (with shellexview) when not using it because it slowed my right click down. I never had the option of optimizing windows explorer, I just had to disable and uninstall stuff till speed improved.
Post Reply