Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Menus&Toolbars » bug in toolbar
bug in toolbar [message #43862] Wed, 12 November 2014 04:47 Go to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
index.php?t=getfile&id=4651&private=0

Test case below causes app to crash by moving mouse pointer quickly back and forth over ToolBar buttons for a while. Crash seems to occur more easily when doing it right after button tip popup.

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class App : public TopWindow
{
	public:
	typedef App CLASSNAME;
	ToolBar bar;
	
	void DoNothing() {}

	void HandleBar(Bar& bar) {
		bar.Add("tip1", CtrlImg::copy(), THISBACK(DoNothing));
		bar.Add("tip2", CtrlImg::paste(), THISBACK(DoNothing));
	}

	App()
	{
		Add(bar.HSizePos().TopPos(0, 30));
		bar.Set(THISBACK(HandleBar));
	}
};

GUI_APP_MAIN
{
	App().Run();
}


Help appreciated, tks in advance.
  • Attachment: MsgBox.PNG
    (Size: 8.16KB, Downloaded 814 times)
Re: bug in toolbar [message #43870 is a reply to message #43862] Wed, 12 November 2014 11:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Spent 5 minutes waving the mouse to reproduce with no success.

Perhaps I am not doing it right - any tips?

Mirek

P.S.: Trying with recent trunk, right?
Re: bug in toolbar [message #43878 is a reply to message #43870] Thu, 13 November 2014 00:30 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Thanks Mirek, for your prompt response.

Version updated to 7884, problem still persists.

In my case, it happens quite variably, from just a few jiggles all the way up to some 40 or 50 back and forth jerks, but consistently always within a time span below 1 minute. BTW, I tried to record a clip to share, but never got a crash when doing so, which makes me wonder if the clip recording software has something to do with it. I mean, maybe the video frame capturing interrupt delays gives Windows a chance to resync its Paint operations somehow, just by slowing down the whole system.

The only tip I could give you is that you should first hover the mouse pointer over a button and wait for the tip popup to show up before vigorously moving mouse pointer quickly from one button to the other. Anyway, couldn't it be the case that Windows invokes WindowProc for tooltip popup while still in Button paint routine?

tks!
Re: bug in toolbar [message #43882 is a reply to message #43878] Thu, 13 November 2014 20:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Unlikely.

Anyway, perhaps you could run in the debugger, send me the stack trace?

Mirek
Re: bug in toolbar [message #43883 is a reply to message #43882] Thu, 13 November 2014 21:33 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
I hope it helps...

index.php?t=getfile&id=4653&private=0

tks!
Re: bug in toolbar [message #43886 is a reply to message #43882] Fri, 14 November 2014 14:36 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Here is another stack trace:
index.php?t=getfile&id=4654&private=0

thanks!
Re: bug in toolbar [message #43889 is a reply to message #43862] Fri, 14 November 2014 18:10 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
First wild guess is that this looks like problem with Image cache.

Can you please try to deactivate paintonly:

void SysImageRealized(const Image& img)
{
return;

(and alternatively same for SysImageReleased)

and report if it is still crashing?

Mirek
Re: bug in toolbar [message #43891 is a reply to message #43889] Fri, 14 November 2014 21:14 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Hi, Mirek,

mirek wrote on Fri, 14 November 2014 12:10


Can you please try to deactivate paintonly:

void SysImageRealized(const Image& img)
{
return;

(and alternatively same for SysImageReleased)

and report if it is still crashing?



Did that on both calls, didn't work, still crashing...

tks.
Re: bug in toolbar [message #43892 is a reply to message #43891] Sat, 15 November 2014 09:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
That's bad. OK, let us add some LOGs:

Size Image::GetSize() const { DDUMP(data); return data ? data->buffer.GetSize() : Size(0, 0); }

void ToolButton::Paint
DLOG("PAINT");

Also, in debug menu there is 'Copy backtrace', which should make posting backtraces easier...

Mirek
Re: bug in toolbar [message #43893 is a reply to message #43892] Sat, 15 November 2014 16:20 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
You got it:
Upp::AssertFailed(file=1545aac "C:\\upp\\uppsrc\\CtrlCore\\Win32Pro".., line=86 'V', cond=2f20058 "WindowProc invoked for App  : 0"..)
Upp::Ctrl::WindowProc(message=132, wParam=0, lParam=11075744)
Upp::TopWindow::WindowProc(message=132, wParam=0, lParam=11075744)
Upp::Ctrl::WndProc(hWnd=6040c->{ unused=?? }, message=132, wParam=0, lParam=11075744)
75c57834 (USER32.dll)
Upp::String0::Free()
Upp::AString<Upp::String0>::~AString<Upp::String0>()
Upp::String0::Free()
Upp::ToolButton::Paint(w=7ef0c0->{  })
Upp::Ctrl::CtrlPaint(w=7ef0c0->{ pageSize={ cx=1366, cy=768 }, nativeSize={ cx=1366, cy=768 }, nativeDpi={ cx=96 '`', cy=96 '`' }, palette=0, color16=0, is_mono=0, native=0, actual_offset_bak={ x=8319220, y=19146303 }, cloff={ vector={ vector=1130190, items=6, alloc=8 } }, drawingclip={ left=0, top=0, right=22, bottom=22 }, .. }, clip=7eec44->{ left=-22, top=0, right=22, bottom=22 })
Upp::Ctrl::CtrlPaint(w=7ef0c0->{ pageSize={ cx=1366, cy=768 }, nativeSize={ cx=1366, cy=768 }, nativeDpi={ cx=96 '`', cy=96 '`' }, palette=0, color16=0, is_mono=0, native=0, actual_offset_bak={ x=8319220, y=19146303 }, cloff={ vector={ vector=1130190, items=6, alloc=8 } }, drawingclip={ left=0, top=0, right=22, bottom=22 }, .. }, clip=7eedf0->{ left=3, top=2, right=47 '/', bottom=24 })
Upp::Ctrl::CtrlPaint(w=7ef0c0->{ pageSize={ cx=1366, cy=768 }, nativeSize={ cx=1366, cy=768 }, nativeDpi={ cx=96 '`', cy=96 '`' }, palette=0, color16=0, is_mono=0, native=0, actual_offset_bak={ x=8319220, y=19146303 }, cloff={ vector={ vector=1130190, items=6, alloc=8 } }, drawingclip={ left=0, top=0, right=22, bottom=22 }, .. }, clip=7ef18c->{ left=3, top=2, right=47 '/', bottom=24 })
Upp::Ctrl::UpdateArea0(draw=7ef4c4->{ pageSize={ cx=1366, cy=768 }, nativeSize={ cx=1366, cy=768 }, nativeDpi={ cx=96 '`', cy=96 '`' }, palette=0, color16=0, is_mono=0, native=0, actual_offset_bak={ x=0, y=13338048 }, cloff={ vector={ vector=2f90bc0, items=1, alloc=4 } }, drawingclip={ left=-1073741823, top=-1073741823, right=1073741823, .. }, .. }, clip=7ef18c->{ left=3, top=2, right=47 '/', bottom=24 }, backpaint=2)
Upp::Ctrl::UpdateArea(draw=7ef4c4->{ pageSize={ cx=1366, cy=768 }, nativeSize={ cx=1366, cy=768 }, nativeDpi={ cx=96 '`', cy=96 '`' }, palette=0, color16=0, is_mono=0, native=0, actual_offset_bak={ x=0, y=13338048 }, cloff={ vector={ vector=2f90bc0, items=1, alloc=4 } }, drawingclip={ left=-1073741823, top=-1073741823, right=1073741823, .. }, .. }, clip=7ef3b8->{ left=3, top=2, right=47 '/', bottom=24 })
Upp::Ctrl::WindowProc(message=15, wParam=0, lParam=0)
Upp::TopWindow::WindowProc(message=15, wParam=0, lParam=0)
Upp::Ctrl::WndProc(hWnd=6040c->{ unused=?? }, message=15, wParam=0, lParam=0)
75c57834 (USER32.dll)
75c5930f (USER32.dll)
75c57bed (USER32.dll)
Upp::Ctrl::sProcessMSG(msg=7ef7c4->{ hwnd=17dd6b0, message=0, wParam=15, lParam=0, time=0, pt={ x=18227988, y=2004061488 } })
Upp::Ctrl::ProcessEvent(quit=7ef8b7->0)
Upp::Ctrl::ProcessEvents(quit=7ef8b7->0)
Upp::Ctrl::EventLoop(ctrl=7ef968->{ parent=0, top=bd0040, exitcode=Null -2147483648, prev=0, next=0, firstchild=7efa78, lastchild=7efa78, pos={ x={ data=1078100987 }, y={ data=1078854136 } }, rect={ left=133, top=156, right=1152, bottom=660 }, frame={ count=1, vector=1, elem0=7ef9a4 "l\001" }, info={ len=0, s=7ef9b0 "" }, caretx=, .., .. })
Upp::TopWindow::Run(appmodal=0)
GuiMainFn_()
Upp::AppExecute__(app=11589ea)
WinMain(hInstance=1150000->{ unused=9460301 }, __formal=0, lpCmdLine=c10e98 "", nCmdShow=10)
__tmainCRTStartup()
WinMainCRTStartup()
75a7919f (KERNEL32.DLL)
77760bbb (ntdll.dll)
77760b91 (ntdll.dll)


thanks!
Re: bug in toolbar [message #43894 is a reply to message #43893] Sat, 15 November 2014 17:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Still no clue Sad

Well, based on log and backtrace provided, I have abandoned theory about a problem in Image cache.

The next hypothesis is that ToolTip somehow overwrites random memory.

To test it, could you please commend out INITBLOCK in CtrlLib/ToolTip.cpp at line 137

/*
INITBLOCK {
	LLOG("Ctrl::InstallMouseHook(ToolTipHook)");
	Ctrl::InstallMouseHook(ToolTipHook);
	Ctrl::InstallStateHook(ToolTipStateHook);
}
*/


and test?

Also, I have noticed that Copy backtrace function does not list line numbers (and fixed that), so I would like to ask you to update ide sources, recompile and use this new ide for backtraces (if any Smile

Thanks for helping me with all this.

Mirek
Re: bug in toolbar [message #43895 is a reply to message #43894] Sat, 15 November 2014 17:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Ah, perhaps I owe you one explanation: That WindowProc issue is most likely caused by simple crashing (most likely invalid pointer because of overwritten memory); Windows then displays that "Program has been terminated" dialog, but that invokes WindowProc (e.g. WM_DEACTIVATE) and leads to that misleading error....
Re: bug in toolbar [message #43899 is a reply to message #43894] Sat, 15 November 2014 20:57 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
mirek wrote on Sat, 15 November 2014 11:55

To test it, could you please commend out INITBLOCK in CtrlLib/ToolTip.cpp at line 137
/*
INITBLOCK {
	LLOG("Ctrl::InstallMouseHook(ToolTipHook)");
	Ctrl::InstallMouseHook(ToolTipHook);
	Ctrl::InstallStateHook(ToolTipStateHook);
}
*/

and test?

Did test as described above and got no more crashes, which should be ok at first sight; however, I should point out that I derived the test case I submitted in this topic from a much larger project I'm working on now and that crashes do persist in it after removing the tool tip hook as you suggest, which makes me even more confused.

mirek wrote on Sat, 15 November 2014 11:55

Also, I have noticed that Copy backtrace function does not list line numbers (and fixed that), so I would like to ask you to update ide sources, recompile and use this new ide for backtraces (if any Smile

Did that, i.e., downloaded 7896.tar.gz from nightly builds, compiled fresh theide.exe, ran it, but I'm afraid backtrace function doesn't seem to list any line numbers yet (if I follow you correctly).

mirek wrote on Sat, 15 November 2014 11:55

Thanks for helping me with all this.

My pleasure! Actually, I'm learning a lot about how to debug with TheIde and I appreciate that Razz
tks again.
Re: bug in toolbar [message #43900 is a reply to message #43862] Sat, 15 November 2014 21:45 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Att. Mirek,

Pls, never mind when I said that the test case no longer crashes when commenting out tool tip mouse hook: after a few attempts, it does!
Besides, I tried with just one single ToolButton on the tool bar and it crashes the same way, just by moving the mouse pointer over the tool bar button and then around the test case window frame, outside it and back again into its workarea. Sometimes the tip label I got for the test case ("tip1") even shows unexpectedly over any other tool button on a background window, like when I slide the mouse pointer swiftly over the IDE toolbar buttons and hover it back again into the test case window work area, when it then crashes... Looks like its messier than I thought. The crash pattern is consistently always the same in the backtrace (Image::Data::Retain() -> USER32.dll ->...crash.

Thank you!

[Updated on: Sat, 15 November 2014 22:52]

Report message to a moderator

Re: bug in toolbar [message #43901 is a reply to message #43900] Sat, 15 November 2014 23:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Hm, well, I guess we can rule out the tooltip.

Another thing worth trying is to gradully remove (comment out, or place early return) parts of ToolButton::Paint and see if it is still crashing...

It will cause visual glitches, but events will still work.

Can you do that please?

Mirek
Re: bug in toolbar [message #43902 is a reply to message #43899] Sat, 15 November 2014 23:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
kropniczki wrote on Sat, 15 November 2014 20:57

Also, I have noticed that Copy backtrace function does not list line numbers (and fixed that), so I would like to ask you to update ide sources, recompile and use this new ide for backtraces (if any Smile


You have to use svn trunk for that... (will build to nightly this night Smile.

Mirek
Re: bug in toolbar [message #43909 is a reply to message #43901] Sun, 16 November 2014 23:20 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Mirek,

Source of bug isolated, but resolution still pending: crashes occur when ToolButton::Paint calls GetMouseLeft() (see Win32Proc.cpp #71) to see if left mouse button was pressed. For some (unknown) reason, the call to user32.dll GetKeyState function trips the crashes, which I could resolve completely by just returning false from GetMouseLeft():
// in ToolButton.cpp:

void  ToolButton::Paint(Draw& w)
{
    ...
  
    int li = IsEnabled() ? HasMouse() ? GetMouseLeft() ? CTRL_PRESSED
		                               : checked ? CTRL_HOTCHECKED : CTRL_HOT
	                       : checked ? CTRL_CHECKED : CTRL_NORMAL
					     : CTRL_DISABLED;
   ...


// in Win32Proc.cpp, around line 71:

// returning false here was enough to cease all crashes!!
bool GetMouseLeft()   { return false; } //!!(GetKeyState(VK_LBUTTON) & 0x8000); }


The point now is to find out why. I checked the Win SDK specs but couldn't get any clues. Any ideas?

tks!
Re: bug in toolbar [message #43910 is a reply to message #43909] Mon, 17 November 2014 00:58 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
No Message Body

[Updated on: Mon, 17 November 2014 22:08]

Report message to a moderator

Re: bug in toolbar [message #43929 is a reply to message #43910] Fri, 21 November 2014 14:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
Does deleting the last message mean in crashes again?

Mirek
Re: bug in toolbar [message #43930 is a reply to message #43929] Fri, 21 November 2014 18:36 Go to previous messageGo to previous message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Yep! I'm afraid it does! Updating windows library hasn't worked. Actually, it happens and disappears just like it comes. I'm working on the hypothesis that some other process might be messing with user32.dll. I'll try to track which process(es) is(are) using it and block its(their) execution to see what happens. Any suggestions?

tks.
Previous Topic: Floating context menu
Next Topic: Menu and UHD on Windows
Goto Forum:
  


Current Time: Fri Nov 01 00:53:49 CET 2024

Total time taken to generate the page: 0.02730 seconds