L
Lothar Behrens
Hi,
I assume, to be right here
My automatic pointer implementation is packaged into a macro, that could
be placed into a class definition.
I have the following code (snippets) that brought me to a problem:
UAP(lb_I_Database, database, __FILE__, __LINE__)
UAP(lb_I_Query, sampleQuery, __FILE__, __LINE__)
long l; // This buffer gets overwritten.
char buf[100]; // This not.
wxWindow* firstButton;
wxWindow* prevButton;
wxWindow* nextButton;
wxWindow* lastButton;
If I do not include this long l or the char buffer, I get overwritten
my real in use window member firstButton.
The code line that invokes this overwrite is as follows:
sampleQuery = database->getQuery(0);
Thanks for any help
Lothar
I think these code may be of relevance of the macro:
#define UAP(interface, Unknown_Reference, file, line) \
class UAP##Unknown_Reference { \
public: \
UAP##Unknown_Reference() { \
_autoPtr = NULL; \
_line = -1; \
_file = NULL; \
allowDelete = 1; \
} \
UAP##Unknown_Reference(const UAP##Unknown_Reference& _ref) { \
_file = NULL; \
if (_ref._file) { \
_file = new char [strlen(_ref._file) + 1]; \
_file = strcpy(_file, _ref._file); \
} \
_line = _ref._line; \
} \
void operator=(const UAP##Unknown_Reference& _ref) { \
if (_file != NULL) { \
delete [] _file; \
if (_ref._file) { \
_file = new char [strlen(_ref._file) + 1]; \
_file = strcpy(_file, _ref._file); \
} \
} \
_line = _ref._line; \
} \
virtual ~UAP##Unknown_Reference() { \
} \
} \
UAP##Unknown_Reference& LB_STDCALL operator = (interface* autoPtr) { \
_autoPtr = autoPtr; \
return *this; \
} \
protected: \
interface* _autoPtr; \
int _line; \
char* _file; \
int allowDelete; \
}; \
\
interface* _UAP##Unknown_Reference; \
UAP##Unknown_Reference Unknown_Reference;
I assume, to be right here
My automatic pointer implementation is packaged into a macro, that could
be placed into a class definition.
I have the following code (snippets) that brought me to a problem:
UAP(lb_I_Database, database, __FILE__, __LINE__)
UAP(lb_I_Query, sampleQuery, __FILE__, __LINE__)
long l; // This buffer gets overwritten.
char buf[100]; // This not.
wxWindow* firstButton;
wxWindow* prevButton;
wxWindow* nextButton;
wxWindow* lastButton;
If I do not include this long l or the char buffer, I get overwritten
my real in use window member firstButton.
The code line that invokes this overwrite is as follows:
sampleQuery = database->getQuery(0);
Thanks for any help
Lothar
I think these code may be of relevance of the macro:
#define UAP(interface, Unknown_Reference, file, line) \
class UAP##Unknown_Reference { \
public: \
UAP##Unknown_Reference() { \
_autoPtr = NULL; \
_line = -1; \
_file = NULL; \
allowDelete = 1; \
} \
UAP##Unknown_Reference(const UAP##Unknown_Reference& _ref) { \
_file = NULL; \
if (_ref._file) { \
_file = new char [strlen(_ref._file) + 1]; \
_file = strcpy(_file, _ref._file); \
} \
_line = _ref._line; \
} \
void operator=(const UAP##Unknown_Reference& _ref) { \
if (_file != NULL) { \
delete [] _file; \
if (_ref._file) { \
_file = new char [strlen(_ref._file) + 1]; \
_file = strcpy(_file, _ref._file); \
} \
} \
_line = _ref._line; \
} \
virtual ~UAP##Unknown_Reference() { \
} \
} \
UAP##Unknown_Reference& LB_STDCALL operator = (interface* autoPtr) { \
_autoPtr = autoPtr; \
return *this; \
} \
protected: \
interface* _autoPtr; \
int _line; \
char* _file; \
int allowDelete; \
}; \
\
interface* _UAP##Unknown_Reference; \
UAP##Unknown_Reference Unknown_Reference;