I have a class _PDevice which is implemented in PDevice.cpp and declared in PDevice.h
Also, in PDevice.h, I have added:
typedef QSharedPointer<_PDevice> DDevice;
Now, there is another class QLDevice which inherits _PDevice
QLDevice also has a public member:
QFile* m_file;
In another file Control.h, I have declared:
DDevice m_device;
And in the file Control.cpp, in a method I have added:
m_device = DDevice(new QLDevice(filePath));
This sets m_file in QLDevice constructor:
m_file = &filePath;
After this when I try to call m_file->close() it throws an error "Unhandled exception at 0x740DCB49 in QXDM.exe: 0xC0000005: Access violation executing location 0x00000000 "
Like this:
if (m_file == NULL)
m_lastError = FCLOSE_NULL_ERR;
else
m_file->close();
I am not understanding where am I making the mistake.
Everything goes fine until I call m_file->close()
Could somebody please help me on this.