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 » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl: Assert Crash due to out of focus Remove
GridCtrl: Assert Crash due to out of focus Remove [message #59852] Thu, 04 May 2023 17:41 Go to next message
devilsclaw is currently offline  devilsclaw
Messages: 72
Registered: August 2022
Member
So I have a program and does an update to a target device and when that device finishes the update it remove the associated GridCtrl row with the Remove method.

During the update process a new window is popped up which is the transfer tracker. this make the main window out of focus. When the update is done and the main frame is out of focus and the GridCtrl row is removed, at this point nothing seems wrong.

Then I click back on the main window and I get VCount out of bound assert, since the current valid cursor points to an invalid row.

GridCtrl::RefreshRow

I tried to add
  if(n >= vitems.GetCount()) {
    return;
  }


which worked until I tried to close the program and then

Upp::GridCtrl::UpdateCtrls(int) is triggered and it has and invalid curpos or oldcur

from this
Point cp(opt & UC_OLDCUR ? oldcur : curpos);


Re: GridCtrl: Assert Crash due to out of focus Remove [message #59853 is a reply to message #59852] Thu, 04 May 2023 17:52 Go to previous message
devilsclaw is currently offline  devilsclaw
Messages: 72
Registered: August 2022
Member
The solution I came up with is to set the valid_cursor to false after a remove

void GridCtrl::Remove(int i, int cnt)
{
	Remove0(i < 0 ? rowidx : fixed_rows + i, cnt);
	valid_cursor = false;
}
Previous Topic: ArrayCtrl vertical grid line dislocated
Next Topic: GridCtrl::ItemRect::GetConvert() return always NULL!!
Goto Forum:
  


Current Time: Fri Apr 26 01:38:47 CEST 2024

Total time taken to generate the page: 0.06230 seconds