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 » U++ Library : Other (not classified elsewhere) » [bug report] EditField::StdBar Undo menu not checked and EditField::RightDown is reentrant
[bug report] EditField::StdBar Undo menu not checked and EditField::RightDown is reentrant [message #37276] Fri, 14 September 2012 08:56 Go to next message
jinshiyi11 is currently offline  jinshiyi11
Messages: 7
Registered: October 2010
Location: CHINA
Promising Member
1.I think Undo menu should be disabled when EditField is readonly.
menu.Add(t_("Undo"), THISBACK(Undo))
		.Key(K_ALT_BACKSPACE)
		.Key(K_CTRL_Z);


So I change it to
menu.Add(IsEditable(),t_("Undo"), THISBACK(Undo))
		.Key(K_ALT_BACKSPACE)
		.Key(K_CTRL_Z);


2.When I repeat right click EditField,the EditField::RightDown method is reentrant.The stack likes the following:
index.php?t=getfile&id=3872&private=0

When I close the parent window,it may crash at the next code line.(It's easy to reproduce it in my project)

In the Upp's help document,"About modal loops and periodic timer events" has talked about this.I think EditField::RightDown should be protected.
  • Attachment: reentrant.png
    (Size: 27.29KB, Downloaded 252 times)

[Updated on: Fri, 14 September 2012 08:57]

Report message to a moderator

Re: [bug report] EditField::StdBar Undo menu not checked and EditField::RightDown is reentrant [message #37294 is a reply to message #37276] Sun, 16 September 2012 20:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12020
Registered: November 2005
Ultimate Member
jinshiyi11 wrote on Fri, 14 September 2012 02:56

1.I think Undo menu should be disabled when EditField is readonly.



Applied.

Quote:


2.When I repeat right click EditField,the EditField::RightDown method is reentrant.The stack likes the following:
index.php?t=getfile&id=3872&private=0

When I close the parent window,it may crash at the next code line.(It's easy to reproduce it in my project)

In the Upp's help document,"About modal loops and periodic timer events" has talked about this.I think EditField::RightDown should be protected.


Changed to

void EditField::RightDown(Point p, dword keyflags)
{
	keep_selection = true;
	Ptr<EditField> self = this;
	MenuBar::Execute(WhenBar);
	if(self) { // protect from destruction when in menu modal loop
		SetFocus();
		keep_selection = false;
	}
}


I hope it helps (would worth checking for other occurences of MenuBar::Execute as well).

Mirek
Re: [bug report] EditField::StdBar Undo menu not checked and EditField::RightDown is reentrant [message #37298 is a reply to message #37294] Mon, 17 September 2012 11:10 Go to previous message
mirek is currently offline  mirek
Messages: 12020
Registered: November 2005
Ultimate Member
I have now also altered MenuBar::Execute to allow only single local menu nesting, which means second right-click just closes the menu. (In fact, it makes previous change in EditField::RightDown unnecessarry, but let us keep it there...)

Mirek

[Updated on: Mon, 17 September 2012 11:15]

Report message to a moderator

Previous Topic: [bug report]DrawTextEllipsis
Next Topic: Class method called by keyboard hook callback has an empty "this" pointer
Goto Forum:
  


Current Time: Thu Sep 19 00:45:38 CEST 2019

Total time taken to generate the page: 0.02251 seconds