Author |
Topic |
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Aug 22 2006 : 06:04:19 AM
|
I applied "Extract Method" on: delete tICD.ptSock;
tICD.ptSock = NULL; where tICD is a struct. VA wants to create the following function: void MyMethod(t_IniterConData& &tICD) Please notice the double ampersand.
Regards, Marcus.
|
|
jpizzi
Tomato Guru
USA
642 Posts |
Posted - Aug 23 2006 : 01:05:30 AM
|
I could get that behavior if I used the following code:
t_IniterConData* whatever = new t_IniterConData();
t_IniterConData& tICD = *whatever;
delete tICD.ptSock;
tICD.ptSock = NULL;
And then called Extract Method on the lines you said. But, since you cannot delete a reference, the code to extract makes no sense. Is it possible that your code is effectively the same, and that is why VA is messing up on it?
Note that I tried this in VS 2005 with VAX 1532. If you are using a different IDE or VAX version, let me know, and I will try it with that one. |
Joe Pizzi |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Aug 23 2006 : 02:55:40 AM
|
case=2200 |
|
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Aug 23 2006 : 04:28:21 AM
|
As I mentioned above, tICD (i.e., t_IniterConData) is a struct. It looks like this: struct t_IniterConData
{
MySocket* ptSock;
...
}
...
t_IniterConData tICD
...
tICD.ptSock = new MySocket(...);
...
delete tICD.ptSock;
tICD.ptSock = NULL; I think that this code is quite correct. At least it works for me.
I'm sorry, I always forget to mention that: I'm using VC6.
Regards, Marcus. |
|
|
jpizzi
Tomato Guru
USA
642 Posts |
Posted - Aug 24 2006 : 12:03:00 AM
|
Wow. I must have been sleeping last night when I wrote that. I saw that you said that t_IniterConData was a struct. What I missed is that the delete operation is on the embedded pointer, not the struct itself. Duh...
At least Sean was awake, and entered a case for this. |
Joe Pizzi |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Aug 24 2006 : 12:59:16 AM
|
...which will be fixed in 1533. |
|
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Aug 24 2006 : 02:15:30 AM
|
Great! Thank you!
Regards, Marcus. |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Aug 27 2006 : 7:16:51 PM
|
Fixed in build 1533. |
|
|
|
Topic |
|