Access Violation?
-
I have a grid (Chris Maunder's MFC Grid) on a formview in one pane of a CSplitterWnd object. The formview has a function called Refresh(). Inside of Refresh(), I call a function of the grid (SetRowCount(1)). Within SetRowCount() it checks to see if 'rows' that I sent in is equal to GetRowCount() like so:
ASSERT(nRows >= 0); if (nRows == GetRowCount()) return bResult;
This works fine when Refresh is called from anywhere else within the form itself. The Refresh() function is public and from another pane I get the CMainFrame* (which has a pointer to the Form that has the grid) and I call the Refresh() function and I get an Access Violation error on this line:int GetRowCount() const { return m_nRows; }
which is being called from the code above in SetRowCount(). Does anyone have any idea what the ^&*( is going on? Thanks,My Music | My Pics | My Articles BlackDice
-
I have a grid (Chris Maunder's MFC Grid) on a formview in one pane of a CSplitterWnd object. The formview has a function called Refresh(). Inside of Refresh(), I call a function of the grid (SetRowCount(1)). Within SetRowCount() it checks to see if 'rows' that I sent in is equal to GetRowCount() like so:
ASSERT(nRows >= 0); if (nRows == GetRowCount()) return bResult;
This works fine when Refresh is called from anywhere else within the form itself. The Refresh() function is public and from another pane I get the CMainFrame* (which has a pointer to the Form that has the grid) and I call the Refresh() function and I get an Access Violation error on this line:int GetRowCount() const { return m_nRows; }
which is being called from the code above in SetRowCount(). Does anyone have any idea what the ^&*( is going on? Thanks,My Music | My Pics | My Articles BlackDice
before you make that call to GetRowCount, what does the pointer to the Grid look like ? is it the same value you see when you call Grid functions that don't cause AVs ? cause, that sounds a bit like a bogus pointer problem...
-
I have a grid (Chris Maunder's MFC Grid) on a formview in one pane of a CSplitterWnd object. The formview has a function called Refresh(). Inside of Refresh(), I call a function of the grid (SetRowCount(1)). Within SetRowCount() it checks to see if 'rows' that I sent in is equal to GetRowCount() like so:
ASSERT(nRows >= 0); if (nRows == GetRowCount()) return bResult;
This works fine when Refresh is called from anywhere else within the form itself. The Refresh() function is public and from another pane I get the CMainFrame* (which has a pointer to the Form that has the grid) and I call the Refresh() function and I get an Access Violation error on this line:int GetRowCount() const { return m_nRows; }
which is being called from the code above in SetRowCount(). Does anyone have any idea what the ^&*( is going on? Thanks,My Music | My Pics | My Articles BlackDice
BlackDice wrote:
Does anyone have any idea what the ^&*( is going on?
Is
this
NULL or a dangling/invalid pointer? Sounds like it...-- Secreted by the Comedy Bee
-
I have a grid (Chris Maunder's MFC Grid) on a formview in one pane of a CSplitterWnd object. The formview has a function called Refresh(). Inside of Refresh(), I call a function of the grid (SetRowCount(1)). Within SetRowCount() it checks to see if 'rows' that I sent in is equal to GetRowCount() like so:
ASSERT(nRows >= 0); if (nRows == GetRowCount()) return bResult;
This works fine when Refresh is called from anywhere else within the form itself. The Refresh() function is public and from another pane I get the CMainFrame* (which has a pointer to the Form that has the grid) and I call the Refresh() function and I get an Access Violation error on this line:int GetRowCount() const { return m_nRows; }
which is being called from the code above in SetRowCount(). Does anyone have any idea what the ^&*( is going on? Thanks,My Music | My Pics | My Articles BlackDice
I found out what it was. I've got 5 different panes that all call back to CMainFrame with functions like SetLeftView(), SetRightView(), etc. I called SetRightView() instead of SetLeftView(), but I'm surprised it even made it that far. Thanks,
My Music | My Pics | My Articles BlackDice