R
Ron Eggler
Hi,
I created a singleton class and can't get rid of it anymore
Uhm, the important things in the definition look like that:
[header]
class GPIOcontrol: public TSPThread
{
public:
static GPIOcontrol* instance(GPSData*); //Method returns pointer of
singleton instance of this class
~GPIOcontrol();
static GPIOcontrol* pinstance; //The instance pointer that is returned
by the method instance() - this is a singleton class
protected:
GPIOcontrol(GPSData *gpsDataObj);
private:
};
void PrepareToDie(void); //This method unsets the singleton pointer
[/header]
I call the PrepareToDie() function from the destructor and get a
segmentation fault, the implementation of this function looks like:
[implementation]
void PrepareToDie(void) //This method unsets the singleton pointer
{
delete GPIOcontrol:instance;
}
[/implementation]
I first had thsi delete PrepareToDie function as a public method in the
class what returned me a seg. fault so i thought i could resolve it by
moving it out of the class but it apparently wouldn't work.
Does anyone know how i can get rid of it and free its memory?
Thank you for hints & suggestions!
Ron
I created a singleton class and can't get rid of it anymore
Uhm, the important things in the definition look like that:
[header]
class GPIOcontrol: public TSPThread
{
public:
static GPIOcontrol* instance(GPSData*); //Method returns pointer of
singleton instance of this class
~GPIOcontrol();
static GPIOcontrol* pinstance; //The instance pointer that is returned
by the method instance() - this is a singleton class
protected:
GPIOcontrol(GPSData *gpsDataObj);
private:
};
void PrepareToDie(void); //This method unsets the singleton pointer
[/header]
I call the PrepareToDie() function from the destructor and get a
segmentation fault, the implementation of this function looks like:
[implementation]
void PrepareToDie(void) //This method unsets the singleton pointer
{
delete GPIOcontrol:instance;
}
[/implementation]
I first had thsi delete PrepareToDie function as a public method in the
class what returned me a seg. fault so i thought i could resolve it by
moving it out of the class but it apparently wouldn't work.
Does anyone know how i can get rid of it and free its memory?
Thank you for hints & suggestions!
Ron