mostly manual d pointer management

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-11-02 01:52:21 +00:00
parent 43e97469f5
commit 937d29e394
27 changed files with 50 additions and 60 deletions

View file

@ -390,7 +390,7 @@ void QSettingsPrivate::setStatus(QSettings::Status status) const
void QSettingsPrivate::update()
{
flush();
sync();
pendingChanges = false;
}
@ -1286,11 +1286,6 @@ void QConfFileSettingsPrivate::sync()
}
}
void QConfFileSettingsPrivate::flush()
{
sync();
}
QString QConfFileSettingsPrivate::fileName() const
{
QConfFile *confFile = confFiles[spec].data();
@ -2138,10 +2133,6 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
drive and Secure ID (UID3) of the application. If the application is
built-in on the ROM, the drive used for SystemScope is \c c:.
\note Symbian SystemScope settings are by default private to the
application and not shared between applications, unlike other
environments.
The paths for the \c .ini and \c .conf files can be changed using
setPath(). On Unix, the user can override them by setting the
\c XDG_CONFIG_HOME environment variable; see setPath() for details.
@ -2467,12 +2458,14 @@ QSettings::~QSettings()
Q_D(QSettings);
if (d->pendingChanges) {
QT_TRY {
d->flush();
d->sync();
} QT_CATCH(...) {
; // ok. then don't flush but at least don't throw in the destructor
; // ok. then don't sync but at least don't throw in the destructor
}
}
#ifdef QT_NO_QOBJECT
delete d_ptr;
#endif
}
/*!

View file

@ -195,7 +195,6 @@ public:
virtual void clear() = 0;
virtual void sync() = 0;
virtual void flush() = 0;
virtual bool isWritable() const = 0;
virtual QString fileName() const = 0;

View file

@ -1730,12 +1730,10 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
emit aboutToShow();
const bool actionListChanged = d->itemsDirty;
d->updateActionRects();
QPoint pos;
QPoint pos = p;
QPushButton *causedButton = qobject_cast<QPushButton*>(d->causedPopup.widget);
if (actionListChanged && causedButton)
pos = QPushButtonPrivate::get(causedButton)->adjustedMenuPosition();
else
pos = p;
QSize size = sizeHint();
QRect screen;

View file

@ -116,7 +116,7 @@ void QHostAddressPrivate::setAddress(const Q_IPV6ADDR &a_)
static bool parseIp4(const QString& address, quint32 *addr)
{
QStringList ipv4 = address.split(QLatin1String("."));
const QStringList ipv4 = address.split(QLatin1String("."));
if (ipv4.count() != 4)
return false;
@ -146,12 +146,12 @@ static bool parseIp6(const QString &address, quint8 *addr, QString *scopeId)
scopeId->clear();
}
QStringList ipv6 = tmp.split(QLatin1String(":"));
int count = ipv6.count();
const QStringList ipv6 = tmp.split(QLatin1String(":"));
const int count = ipv6.count();
if (count < 3 || count > 8)
return false;
int colonColon = tmp.count(QLatin1String("::"));
const int colonColon = tmp.count(QLatin1String("::"));
if(count == 8 && colonColon > 1)
return false;
@ -222,7 +222,7 @@ bool QHostAddressPrivate::parse()
{
isParsed = true;
protocol = QAbstractSocket::UnknownNetworkLayerProtocol;
QString a = ipString.simplified();
const QString a = ipString.simplified();
// All IPv6 addresses contain a ':', and may contain a '.'.
if (a.contains(QLatin1Char(':'))) {
@ -522,7 +522,8 @@ QHostAddress::QHostAddress(SpecialAddress address)
*/
QHostAddress::~QHostAddress()
{
delete d;
// ###: leaking pointer, something is accessing it?
// delete d;
}
/*!

View file

@ -92,6 +92,7 @@ QScriptable::QScriptable()
*/
QScriptable::~QScriptable()
{
delete d_ptr;
}
/*!

View file

@ -26,8 +26,6 @@
#include <QtCore/qobjectdefs.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@ -54,7 +52,7 @@ public:
QScriptValue argument(int index) const;
private:
QScopedPointer<QScriptablePrivate> d_ptr;
QScriptablePrivate* d_ptr;
Q_DISABLE_COPY(QScriptable)
Q_DECLARE_PRIVATE(QScriptable)

View file

@ -156,6 +156,7 @@ QScriptClass::QScriptClass(QScriptEngine *engine, QScriptClassPrivate &dd)
*/
QScriptClass::~QScriptClass()
{
delete d_ptr;
}
/*!

View file

@ -27,7 +27,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qvariant.h>
#include <QtCore/qscopedpointer.h>
#include <QtScript/qscriptvalue.h>
QT_BEGIN_HEADER
@ -83,7 +82,7 @@ public:
protected:
QScriptClass(QScriptEngine *engine, QScriptClassPrivate &dd);
QScopedPointer<QScriptClassPrivate> d_ptr;
QScriptClassPrivate* d_ptr;
private:
Q_DECLARE_PRIVATE(QScriptClass)

View file

@ -94,6 +94,7 @@ QScriptClassPropertyIterator::QScriptClassPropertyIterator(const QScriptValue &o
*/
QScriptClassPropertyIterator::~QScriptClassPropertyIterator()
{
delete d_ptr;
}
/*!

View file

@ -25,8 +25,6 @@
#define QSCRIPTCLASSPROPERTYITERATOR_H
#include <QtCore/qstring.h>
#include <QtCore/qscopedpointer.h>
#include <QtScript/qscriptvalue.h>
QT_BEGIN_HEADER
@ -60,7 +58,7 @@ public:
protected:
QScriptClassPropertyIterator(const QScriptValue &object, QScriptClassPropertyIteratorPrivate &dd);
QScopedPointer<QScriptClassPropertyIteratorPrivate> d_ptr;
QScriptClassPropertyIteratorPrivate* d_ptr;
private:
Q_DECLARE_PRIVATE(QScriptClassPropertyIterator)

View file

@ -262,7 +262,7 @@ private:
protected:
#ifdef QT_NO_QOBJECT
QScopedPointer<QScriptEnginePrivate> d_ptr;
QScriptEnginePrivate* d_ptr;
QScriptEngine(QScriptEnginePrivate &dd);
#else

View file

@ -242,6 +242,7 @@ QScriptEngineAgent::QScriptEngineAgent(QScriptEngineAgentPrivate &dd, QScriptEng
QScriptEngineAgent::~QScriptEngineAgent()
{
d_ptr->engine->agentDeleted(this); //### TODO: Can this throw?
delete d_ptr;
}
/*!

View file

@ -25,9 +25,7 @@
#define QSCRIPTENGINEAGENT_H
#include <QtCore/qobjectdefs.h>
#include <QtCore/qvariant.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
@ -76,7 +74,7 @@ public:
protected:
QScriptEngineAgent(QScriptEngineAgentPrivate &dd, QScriptEngine *engine);
QScopedPointer<QScriptEngineAgentPrivate> d_ptr;
QScriptEngineAgentPrivate* d_ptr;
private:
Q_DECLARE_PRIVATE(QScriptEngineAgent)

View file

@ -140,7 +140,7 @@ QScriptValueIterator::QScriptValueIterator(const QScriptValue &object)
: d_ptr(0)
{
if (object.isObject()) {
d_ptr.reset(new QScriptValueIteratorPrivate());
d_ptr = new QScriptValueIteratorPrivate();
d_ptr->objectValue = object;
}
}
@ -150,6 +150,7 @@ QScriptValueIterator::QScriptValueIterator(const QScriptValue &object)
*/
QScriptValueIterator::~QScriptValueIterator()
{
delete d_ptr;
}
/*!
@ -351,9 +352,9 @@ void QScriptValueIterator::remove()
*/
QScriptValueIterator& QScriptValueIterator::operator=(QScriptValue &object)
{
d_ptr.reset();
delete d_ptr;
if (object.isObject()) {
d_ptr.reset(new QScriptValueIteratorPrivate());
d_ptr = new QScriptValueIteratorPrivate();
d_ptr->objectValue = object;
}
return *this;

View file

@ -26,8 +26,6 @@
#include <QtScript/qscriptvalue.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@ -65,7 +63,7 @@ public:
QScriptValueIterator& operator=(QScriptValue &value);
private:
QScopedPointer<QScriptValueIteratorPrivate> d_ptr;
QScriptValueIteratorPrivate* d_ptr;
Q_DECLARE_PRIVATE(QScriptValueIterator)
Q_DISABLE_COPY(QScriptValueIterator)

View file

@ -414,6 +414,7 @@ QScriptContext * QScriptDeclarativeClass::pushCleanContext(QScriptEngine *engine
QScriptDeclarativeClass::~QScriptDeclarativeClass()
{
delete d_ptr;
}
QScriptEngine *QScriptDeclarativeClass::engine() const

View file

@ -148,7 +148,7 @@ public:
QScriptContext *context() const;
protected:
friend class QScriptDeclarativeClassPrivate;
QScopedPointer<QScriptDeclarativeClassPrivate> d_ptr;
QScriptDeclarativeClassPrivate* d_ptr;
};
QT_END_NAMESPACE

View file

@ -56,7 +56,7 @@ public:
bool supportsCall:1;
static QScriptDeclarativeClassPrivate *get(QScriptDeclarativeClass *c) {
return c->d_ptr.data();
return c->d_ptr;
}
};

View file

@ -560,6 +560,7 @@ QSvgGenerator::~QSvgGenerator()
if (d->owns_iodevice)
delete d->engine->outputDevice();
delete d->engine;
delete d_ptr;
}
/*!

View file

@ -49,7 +49,6 @@
#include <QtCore/qnamespace.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
@ -102,7 +101,7 @@ protected:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
private:
QScopedPointer<QSvgGeneratorPrivate> d_ptr;
QSvgGeneratorPrivate* d_ptr;
};
QT_END_NAMESPACE

View file

@ -119,7 +119,7 @@ signals:
void toolBarChanged(QToolBar *toolBar, const QList<QAction *> &actions);
private:
QScopedPointer<QtFullToolBarManagerPrivate> d_ptr;
QtFullToolBarManagerPrivate* d_ptr;
Q_DECLARE_PRIVATE(QtFullToolBarManager)
Q_DISABLE_COPY(QtFullToolBarManager)
};
@ -450,6 +450,7 @@ QtFullToolBarManager::QtFullToolBarManager(QObject *parent)
QtFullToolBarManager::~QtFullToolBarManager()
{
delete d_ptr;
}
void QtFullToolBarManager::setMainWindow(QMainWindow *mainWindow)
@ -841,6 +842,7 @@ QtToolBarManager::QtToolBarManager(QObject *parent)
*/
QtToolBarManager::~QtToolBarManager()
{
delete d_ptr;
}
/*!
@ -1829,6 +1831,7 @@ QtToolBarDialog::QtToolBarDialog(QWidget *parent, Qt::WindowFlags flags)
QtToolBarDialog::~QtToolBarDialog()
{
d_ptr->clearOld();
delete d_ptr;
}
/*!

View file

@ -88,7 +88,7 @@ public:
private:
friend class QtToolBarDialog;
QScopedPointer<QtToolBarManagerPrivate> d_ptr;
QtToolBarManagerPrivate* d_ptr;
Q_DECLARE_PRIVATE(QtToolBarManager)
Q_DISABLE_COPY(QtToolBarManager)
};
@ -112,7 +112,7 @@ protected:
private:
QScopedPointer<QtToolBarDialogPrivate> d_ptr;
QtToolBarDialogPrivate* d_ptr;
Q_DECLARE_PRIVATE(QtToolBarDialog)
Q_DISABLE_COPY(QtToolBarDialog)

View file

@ -645,6 +645,7 @@ QUiLoader::QUiLoader(QObject *parent)
*/
QUiLoader::~QUiLoader()
{
delete d_ptr;
}
/*!

View file

@ -43,7 +43,6 @@
#define QUILOADER_H
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
QT_BEGIN_HEADER
@ -91,7 +90,7 @@ public:
bool isTranslationEnabled() const;
private:
QScopedPointer<QUiLoaderPrivate> d_ptr;
QUiLoaderPrivate* d_ptr;
Q_DECLARE_PRIVATE(QUiLoader)
Q_DISABLE_COPY(QUiLoader)
};

View file

@ -58,6 +58,8 @@
#include <qmap.h>
#include <qshareddata.h>
#include <qdebug.h>
#include <qscopedpointer.h>
#include <stdio.h>
QT_BEGIN_NAMESPACE

View file

@ -263,10 +263,6 @@ class QXmlLocatorPrivate
{
};
class QXmlDefaultHandlerPrivate
{
};
class QXmlSimpleReaderPrivate
{
public:
@ -358,7 +354,7 @@ private:
bool contentCharDataRead;
// helper classes
QScopedPointer<QXmlLocator> locator;
QXmlLocator* locator;
QXmlNamespaceSupport namespaceSupport;
// error string
@ -587,6 +583,7 @@ QXmlParseException::QXmlParseException(const QXmlParseException& other) :
*/
QXmlParseException::~QXmlParseException()
{
delete d;
}
/*!
@ -2732,7 +2729,7 @@ QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader)
q_ptr = reader;
parseStack = 0;
locator.reset(new QXmlSimpleReaderLocator(reader));
locator = new QXmlSimpleReaderLocator(reader);
entityRes = 0;
dtdHnd = 0;
contentHnd = 0;
@ -2750,6 +2747,7 @@ QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader)
QXmlSimpleReaderPrivate::~QXmlSimpleReaderPrivate()
{
delete parseStack;
delete locator;
}
void QXmlSimpleReaderPrivate::initIncrementalParsing()
@ -3133,6 +3131,7 @@ QXmlSimpleReader::QXmlSimpleReader()
*/
QXmlSimpleReader::~QXmlSimpleReader()
{
delete d_ptr;
}
/*!
@ -3419,7 +3418,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
// call the handler
if (d->contentHnd) {
d->contentHnd->setDocumentLocator(d->locator.data());
d->contentHnd->setDocumentLocator(d->locator);
if (!d->contentHnd->startDocument()) {
d->reportParseError(d->contentHnd->errorString());
d->tags.clear();

View file

@ -47,7 +47,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
@ -196,7 +195,7 @@ public:
QString message() const;
private:
QScopedPointer<QXmlParseExceptionPrivate> d;
QXmlParseExceptionPrivate* d;
};
@ -265,7 +264,7 @@ public:
private:
Q_DISABLE_COPY(QXmlSimpleReader)
Q_DECLARE_PRIVATE(QXmlSimpleReader)
QScopedPointer<QXmlSimpleReaderPrivate> d_ptr;
QXmlSimpleReaderPrivate* d_ptr;
friend class QXmlSimpleReaderLocator;
};
@ -403,7 +402,6 @@ public:
QString errorString() const;
private:
QXmlDefaultHandlerPrivate *d;
Q_DISABLE_COPY(QXmlDefaultHandler)
};