Document data variable "needs stack frame"

My View Class includes a private  member which is a pointer to my Document.

 If I call a public function in my View Class from my MainFrame, I can
access the variables in my Document class.

However, when that function calls another public function in the same View
class, the second function can't access the Document variables. It causes
Access Violation 0xC0000005. I was using the debugger to try & monitor the
variables in the Document, and it displayed the message "CXX0069 variable
needs stack frame"

I could get around this by passed the required data to the second function
as a parameter. However, I don't understand why I'm having a problem.

0
5/30/2005 8:55:02 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
905 Views

Similar Articles

[PageSpeed] 39

Say something about the functions! Your description is too vague to allow any analysis.

Generally, I would never call a public method of a view class from the mainframe. But
without some idea of what the methods are or what they do, I have no idea what to tell
you.
				joe

On Mon, 30 May 2005 20:55:02 GMT, "Ted" <noaddress@fuspammer.com> wrote:

>My View Class includes a private  member which is a pointer to my Document.
>
> If I call a public function in my View Class from my MainFrame, I can
>access the variables in my Document class.
>
>However, when that function calls another public function in the same View
>class, the second function can't access the Document variables. It causes
>Access Violation 0xC0000005. I was using the debugger to try & monitor the
>variables in the Document, and it displayed the message "CXX0069 variable
>needs stack frame"
>
>I could get around this by passed the required data to the second function
>as a parameter. However, I don't understand why I'm having a problem.

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
5/31/2005 5:30:57 PM
My program is an SDI with more than one view. Switching views is controlled
by the MainFrame. When it switches to the ListView, the MainFrame calls a
function in the ListView to populate the list. This involves reading some
data items from the Document & doing some simple calculations. This main
function can access the Document data OK. One of the functions it calls to
do some subsidiary calculations has the problem. All this second function
does is perform two loops which sum elements from different arrays over
different ranges, then add those totals and divide by two. The data it has
troble accessing is used to calculate the range over which array elements
have to be summed. The arrays themselves are ListView class members.


"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:6o7p911foddsrq7bs823694vg1ne3hcja2@4ax.com...
> Say something about the functions! Your description is too vague to allow
any analysis.
>
> Generally, I would never call a public method of a view class from the
mainframe. But
> without some idea of what the methods are or what they do, I have no idea
what to tell
> you.
> joe
>
> On Mon, 30 May 2005 20:55:02 GMT, "Ted" <noaddress@fuspammer.com> wrote:
>
> >My View Class includes a private  member which is a pointer to my
Document.
> >
> > If I call a public function in my View Class from my MainFrame, I can
> >access the variables in my Document class.
> >
> >However, when that function calls another public function in the same
View
> >class, the second function can't access the Document variables. It causes
> >Access Violation 0xC0000005. I was using the debugger to try & monitor
the
> >variables in the Document, and it displayed the message "CXX0069 variable
> >needs stack frame"
> >
> >I could get around this by passed the required data to the second
function
> >as a parameter. However, I don't understand why I'm having a problem.
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm

0
5/31/2005 9:26:15 PM
You need to indicate where the error was. Otherwise, it is hard to guess what you have
done. All you said was that the variable needs a stack frame, which is the usual effect
you see if the access fault occurs before the stack frame is fully initiailized, such as
in a one-line function. But without useful information about what is happening, it is hard
to offer any support.

I don't believe in SDI anyway; every time I wrote an SDI app, it had to be converted to an
MDI app, so I simply stopped writing them.  I've yet to write an MDI app that should have
been an SDI app. For SDI-style apps, I use dialog-based apps, and for multiple views, I
favor tabbed dialogs.
				joe

On Mon, 30 May 2005 20:55:02 GMT, "Ted" <noaddress@fuspammer.com> wrote:

>My View Class includes a private  member which is a pointer to my Document.
>
> If I call a public function in my View Class from my MainFrame, I can
>access the variables in my Document class.
>
>However, when that function calls another public function in the same View
>class, the second function can't access the Document variables. It causes
>Access Violation 0xC0000005. I was using the debugger to try & monitor the
>variables in the Document, and it displayed the message "CXX0069 variable
>needs stack frame"
>
>I could get around this by passed the required data to the second function
>as a parameter. However, I don't understand why I'm having a problem.

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
6/1/2005 3:36:27 AM
Reply:

Similar Artilces:

Document data variable "needs stack frame"
My View Class includes a private member which is a pointer to my Document. If I call a public function in my View Class from my MainFrame, I can access the variables in my Document class. However, when that function calls another public function in the same View class, the second function can't access the Document variables. It causes Access Violation 0xC0000005. I was using the debugger to try & monitor the variables in the Document, and it displayed the message "CXX0069 variable needs stack frame" I could get around this by passed the required data to the second functi...