Bad pointer
-
Hi, in a particular situation, my pointer
pManager
becomes somewhat faulty. It passes theif (pManager) {
check, but most of the members are not active and the code crashes when I try to access them. Now, I want to check if a particular member inside the pointer is valid. When I try like thisif (pManager->bMember) {
, the code crashes. Are there any functions to check the integrity of a member? Regards, Stefan -
Hi, in a particular situation, my pointer
pManager
becomes somewhat faulty. It passes theif (pManager) {
check, but most of the members are not active and the code crashes when I try to access them. Now, I want to check if a particular member inside the pointer is valid. When I try like thisif (pManager->bMember) {
, the code crashes. Are there any functions to check the integrity of a member? Regards, StefanStefan Spenz wrote:
When I try like this if (pManager->bMember)
pManager itself is invalid that is why the error occurs. You can use IsBadReadPtr,IsBadWritePtr according to your requirement. But you could handle the situation without these functions.
SaRath.
_"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
-
Hi, in a particular situation, my pointer
pManager
becomes somewhat faulty. It passes theif (pManager) {
check, but most of the members are not active and the code crashes when I try to access them. Now, I want to check if a particular member inside the pointer is valid. When I try like thisif (pManager->bMember) {
, the code crashes. Are there any functions to check the integrity of a member? Regards, Stefando you construct the object correctly, and how to you assign pManager ?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
Hi, in a particular situation, my pointer
pManager
becomes somewhat faulty. It passes theif (pManager) {
check, but most of the members are not active and the code crashes when I try to access them. Now, I want to check if a particular member inside the pointer is valid. When I try like thisif (pManager->bMember) {
, the code crashes. Are there any functions to check the integrity of a member? Regards, StefanHow do you declare
pManager
Can you show_**
**_
WhiteSky
-
Hi, in a particular situation, my pointer
pManager
becomes somewhat faulty. It passes theif (pManager) {
check, but most of the members are not active and the code crashes when I try to access them. Now, I want to check if a particular member inside the pointer is valid. When I try like thisif (pManager->bMember) {
, the code crashes. Are there any functions to check the integrity of a member? Regards, StefanIf the pointer
pManager
was never initialized usingpManager = new Manager(); // or whatever the class name is
that will cause this problem. If the pointer
pManager
was initialized but now causes an access violation, it probably means the you have issued a "delete pManager;
" at some point.pManager
now points to memory you no longer own.
Software Zen:
delete this;