Problem with contact listener and class variables

Hello Box2D forums,

I've been pulling my hair out trying to figure out why this class variable isn't changing.

Here's the class header. The function in question is startContact(). The cout command is working fine, but Contacting refuses to change to true.
Code:
#ifndef SHELL_H
#define SHELL_H

#include <Box2D/Box2D.h>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>

class Shell{
    public:
        static std::vector<Shell> ShellVect;
        static b2World *ShellWorld;
        static void Create(double X, double Y, double Angle, b2World &World);
        static void Update(sf::RenderWindow &GameWindow);

        sf::Shape ShellSh;
        b2BodyDef ShellDef; //define static ground body
        b2Body* ShellBody;
        b2CircleShape ShellHull; //define its polygon
        b2FixtureDef ShellfixtureDef; //define it's fixture information (dynamic fixtures)
        b2Vec2 position;
        double Time;
        bool Contacting;

        Shell(double X, double Y, double Angle, b2World &World);
        ~Shell();

        void startContact(){
            this->Contacting = true;
            std::cout << "JJJJJJJJJJJJJJJJJJJJJJJJJ";
        }
        void endContact() {  }
};

#endif // SHELL_H


startContact is called through a MyContactListener class. It calls the function fine, but I can't figure out why the cout runs but the Contacting variable doesn't change.

Here's is the function that calls startContact()

Code:
void MyContactListener::BeginContact(b2Contact* contact) {
     //check if fixture A was a Shell
      void* bodyUserData = contact->GetFixtureA()->GetBody()->GetUserData();
      if ( bodyUserData ){
        static_cast<Shell*>( bodyUserData )->startContact();
     
      }

      //check if fixture B was a Shell
      bodyUserData = contact->GetFixtureB()->GetBody()->GetUserData();
      if ( bodyUserData ){
        static_cast<Shell*>( bodyUserData )->startContact();
     
      }
}


Any insight? 😢
You mean if you print out the value of Contacting in the line with 'JJJJJJ' you get false???
It prints true. But if I print all of the Contacting variables from every Shell object, none are true.

I have a feeling that the pointer isn't pointing to the correct object.
Just to be sure, the only type of user data you set in a body is a Shell pointer right? They should be created with new.
It was set like so in the constructor:

Code:
ShellBody->SetUserData( this );
Ah, I've found the problem. Since I was storing the Shells in a vector by value, when they were pushed onto the vector a orphaned pointer was created. I've switched it over to by pointer, and it now works fine.

Original thread: https://box2d.org/forum/viewtopic.php?t=8329