Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash fixes #198

Merged
merged 10 commits into from
Sep 10, 2021
7 changes: 3 additions & 4 deletions src/autoprofileinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ class AutoProfileInfo : public QObject
Q_OBJECT

public:
explicit AutoProfileInfo(QString uniqueID, QString profileLocation, bool active, bool partialTitle,
QObject *parent = nullptr);
explicit AutoProfileInfo(QString uniqueID, QString profileLocation, bool active, bool partialTitle, QObject *parent);
explicit AutoProfileInfo(QString uniqueID, QString profileLocation, QString exe, bool active, bool partialTitle,
QObject *parent = nullptr);
explicit AutoProfileInfo(QObject *parent = 0);
QObject *parent);
explicit AutoProfileInfo(QObject *parent);
~AutoProfileInfo();

// void setGUID(QString guid);
Expand Down
12 changes: 6 additions & 6 deletions src/autoprofilewatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ void AutoProfileWatcher::syncProfileAssignment()
QList<AutoProfileInfo *> templist;

if (getAppProfileAssignments().contains(exe))
templist = getAppProfileAssignments().value(exe);
templist = appProfileAssignments.value(exe);

templist.append(info);
appProfileAssignments.insert(exe, templist);
Expand Down Expand Up @@ -477,7 +477,7 @@ void AutoProfileWatcher::syncProfileAssignment()
void AutoProfileWatcher::clearProfileAssignments()
{
QSet<AutoProfileInfo *> terminateProfiles;
QListIterator<QList<AutoProfileInfo *>> iterDelete(getAppProfileAssignments().values());
QListIterator<QList<AutoProfileInfo *>> iterDelete(appProfileAssignments.values());

while (iterDelete.hasNext())
{
Expand All @@ -487,7 +487,7 @@ void AutoProfileWatcher::clearProfileAssignments()

appProfileAssignments.clear();

QListIterator<QList<AutoProfileInfo *>> iterClassDelete(getWindowClassProfileAssignments().values());
QListIterator<QList<AutoProfileInfo *>> iterClassDelete(windowClassProfileAssignments.values());

while (iterClassDelete.hasNext())
{
Expand All @@ -497,7 +497,7 @@ void AutoProfileWatcher::clearProfileAssignments()

windowClassProfileAssignments.clear();

QListIterator<QList<AutoProfileInfo *>> iterNameDelete(getWindowNameProfileAssignments().values());
QListIterator<QList<AutoProfileInfo *>> iterNameDelete(windowNameProfileAssignments.values());

while (iterNameDelete.hasNext())
{
Expand All @@ -514,7 +514,7 @@ void AutoProfileWatcher::clearProfileAssignments()
AutoProfileInfo *info = iterTerminate.next();
if (info != nullptr)
{
delete info;
info->deleteLater();
info = nullptr;
}
}
Expand All @@ -526,7 +526,7 @@ void AutoProfileWatcher::clearProfileAssignments()
AutoProfileInfo *info = iterDefaultsDelete.next();
if (info != nullptr)
{
delete info;
info->deleteLater();
info = nullptr;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,10 @@ void Calibration::createAxesConnection()
while (!hb->isEmpty())
{
QWidget *w = hb->takeAt(0)->widget();
delete w;
w->deleteLater();
}

delete hb;
hb->deleteLater();
}

update();
Expand Down
9 changes: 0 additions & 9 deletions src/eventhandlerfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ EventHandlerFactory::EventHandlerFactory(QString handler, QObject *parent)
#endif
}

EventHandlerFactory::~EventHandlerFactory()
{
if (eventHandler != nullptr)
{
delete eventHandler;
eventHandler = nullptr;
}
}

EventHandlerFactory *EventHandlerFactory::getInstance(QString handler)
{
if (instance == nullptr)
Expand Down
1 change: 0 additions & 1 deletion src/eventhandlerfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class EventHandlerFactory : public QObject

protected:
explicit EventHandlerFactory(QString handler, QObject *parent = nullptr);
~EventHandlerFactory();

BaseEventHandler *eventHandler;
static EventHandlerFactory *instance;
Expand Down
2 changes: 2 additions & 0 deletions src/gamecontroller/gamecontrollertrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const GameControllerTrigger::ThrottleTypes GameControllerTrigger::DEFAULTTHROTTL
GameControllerTrigger::GameControllerTrigger(int index, int originset, SetJoystick *parentSet, QObject *parent)
: JoyAxis(index, originset, parentSet, parent)
{
naxisbutton->deleteLater();
naxisbutton = new GameControllerTriggerButton(this, 0, originset, parentSet, this);
paxisbutton->deleteLater();
paxisbutton = new GameControllerTriggerButton(this, 1, originset, parentSet, this);
reset(index);
}
Expand Down
16 changes: 8 additions & 8 deletions src/inputdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ InputDaemon::~InputDaemon()
{
sdlWorkerThread->quit();
sdlWorkerThread->wait();
delete sdlWorkerThread;
sdlWorkerThread->deleteLater();
sdlWorkerThread = nullptr;
}
}
Expand Down Expand Up @@ -161,7 +161,7 @@ void InputDaemon::refreshJoysticks()
if (joystick != nullptr)
{
m_joysticks->remove(iter.key());
delete joystick;
joystick->deleteLater();
}
}

Expand Down Expand Up @@ -688,7 +688,7 @@ InputDaemon::createOrGrabBitStatusEntry(QHash<InputDevice *, InputDeviceBitArray

if (!statusHash->contains(device))
{
bitArrayStatus = new InputDeviceBitArrayStatus(device, readCurrent);
bitArrayStatus = new InputDeviceBitArrayStatus(device, readCurrent, this);
statusHash->insert(device, bitArrayStatus);
} else
{
Expand Down Expand Up @@ -967,7 +967,7 @@ void InputDaemon::modifyUnplugEvents(QQueue<SDL_Event> *sdlEventQueue)

QBitArray InputDaemon::createUnplugEventBitArray(InputDevice *device)
{
InputDeviceBitArrayStatus tempStatus(device, false);
InputDeviceBitArrayStatus tempStatus(device, false, this);

for (int i = 0; i < device->getNumberRawAxes(); i++)
{
Expand Down Expand Up @@ -1164,30 +1164,30 @@ void InputDaemon::secondInputPass(QQueue<SDL_Event> *sdlEventQueue)

void InputDaemon::clearBitArrayStatusInstances()
{
QHashIterator<InputDevice *, InputDeviceBitArrayStatus *> genIter(getReleaseEventsGeneratedLocal());
QHashIterator<InputDevice *, InputDeviceBitArrayStatus *> genIter(releaseEventsGenerated);

while (genIter.hasNext())
{
InputDeviceBitArrayStatus *temp = genIter.next().value();

if (temp != nullptr)
{
delete temp;
temp->deleteLater();
temp = nullptr;
}
}

getReleaseEventsGeneratedLocal().clear();

QHashIterator<InputDevice *, InputDeviceBitArrayStatus *> pendIter(getPendingEventValuesLocal());
QHashIterator<InputDevice *, InputDeviceBitArrayStatus *> pendIter(pendingEventValues);

while (pendIter.hasNext())
{
InputDeviceBitArrayStatus *temp = pendIter.next().value();

if (temp != nullptr)
{
delete temp;
temp->deleteLater();
temp = nullptr;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/inputdevicebitarraystatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class InputDeviceBitArrayStatus : public QObject
Q_OBJECT

public:
explicit InputDeviceBitArrayStatus(InputDevice *device, bool readCurrent = true, QObject *parent = nullptr);
explicit InputDeviceBitArrayStatus(InputDevice *device, bool readCurrent, QObject *parent);

void changeAxesStatus(int axisIndex, bool value);
void changeButtonStatus(int buttonIndex, bool value);
Expand Down
24 changes: 12 additions & 12 deletions src/joybutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2072,7 +2072,7 @@ bool JoyButton::setAssignedSlot(int code, JoyButtonSlot::JoySlotInputAction mode
emit slotsChanged();
} else if (slot != nullptr)
{
delete slot;
slot->deleteLater();
slot = nullptr;
}

Expand Down Expand Up @@ -2117,7 +2117,7 @@ bool JoyButton::setAssignedSlot(int code, int alias, JoyButtonSlot::JoySlotInput
emit slotsChanged();
} else if (slot != nullptr)
{
delete slot;
slot->deleteLater();
slot = nullptr;
}

Expand Down Expand Up @@ -2157,7 +2157,7 @@ bool JoyButton::setAssignedSlot(int code, int alias, int index, JoyButtonSlot::J
JoyButtonSlot *temp = getAssignedSlots()->at(index);
if (temp != nullptr)
{
delete temp;
temp->deleteLater();
temp = nullptr;
}

Expand All @@ -2174,7 +2174,7 @@ bool JoyButton::setAssignedSlot(int code, int alias, int index, JoyButtonSlot::J
emit slotsChanged();
} else if (slot != nullptr)
{
delete slot;
slot->deleteLater();
slot = nullptr;
}

Expand Down Expand Up @@ -2226,7 +2226,7 @@ bool JoyButton::insertAssignedSlot(int code, int alias, int index, JoyButtonSlot
emit slotsChanged();
} else if (slot != nullptr)
{
delete slot;
slot->deleteLater();
slot = nullptr;
}

Expand Down Expand Up @@ -2309,7 +2309,7 @@ bool JoyButton::insertAssignedSlot(JoyButtonSlot *newSlot, int index, bool updat
qDeleteAll(*slot->getMixSlots());
}*/

delete slot;
slot->deleteLater();
slot = nullptr;
}

Expand Down Expand Up @@ -2356,7 +2356,7 @@ bool JoyButton::setAssignedSlot(JoyButtonSlot *otherSlot, int index)
{
for (auto minislot : *temp->getMixSlots())
{
delete minislot;
minislot->deleteLater();
minislot = nullptr;
}

Expand All @@ -2366,7 +2366,7 @@ bool JoyButton::setAssignedSlot(JoyButtonSlot *otherSlot, int index)

if (temp != nullptr)
{
delete temp;
temp->deleteLater();
temp = nullptr;
}

Expand All @@ -2382,7 +2382,7 @@ bool JoyButton::setAssignedSlot(JoyButtonSlot *otherSlot, int index)
emit slotsChanged();
} else if (newslot != nullptr)
{
delete newslot;
newslot->deleteLater();
newslot = nullptr;
}

Expand Down Expand Up @@ -3010,7 +3010,7 @@ void JoyButton::clearAssignedSlots(bool signalEmit)
slot->cleanMixSlots();
}

delete slot;
slot->deleteLater();
slot = nullptr;
}
}
Expand Down Expand Up @@ -3043,7 +3043,7 @@ void JoyButton::removeAssignedSlot(int index)
{
for (auto minislot : *slot->getMixSlots())
{
delete minislot;
minislot->deleteLater();
minislot = nullptr;
}

Expand All @@ -3054,7 +3054,7 @@ void JoyButton::removeAssignedSlot(int index)
getAssignedSlots()->removeAt(index);
} else
{
delete slot;
slot->deleteLater();
slot = nullptr;
}

Expand Down
3 changes: 2 additions & 1 deletion src/joybuttontypes/joyaxisbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define JOYAXISBUTTON_H

#include "joybuttontypes/joygradientbutton.h"
#include "logger.h"

class VDPad;
class SetJoystick;
Expand All @@ -30,7 +31,7 @@ class JoyAxisButton : public JoyGradientButton
Q_OBJECT

public:
explicit JoyAxisButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent = 0);
explicit JoyAxisButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent);

virtual QString getPartialName(bool forceFullFormat = false, bool displayNames = false) const;
virtual QString getXmlName();
Expand Down
2 changes: 1 addition & 1 deletion src/joybuttontypes/joydpadbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class JoyDPadButton : public JoyButton
Q_OBJECT

public:
JoyDPadButton(int direction, int originset, JoyDPad *dpad, SetJoystick *parentSet, QObject *parent = 0);
JoyDPadButton(int direction, int originset, JoyDPad *dpad, SetJoystick *parentSet, QObject *parent);

virtual int getRealJoyNumber() const override;
virtual QString getPartialName(bool forceFullFormat = false, bool displayNames = false) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/joybuttontypes/joygradientbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class JoyGradientButton : public JoyButton
Q_OBJECT

public:
explicit JoyGradientButton(int index, int originset, SetJoystick *parentSet, QObject *parent = 0);
explicit JoyGradientButton(int index, int originset, SetJoystick *parentSet, QObject *parent);

using JoyButton::getPartialName;
using JoyButton::setChangeSetCondition;
Expand Down
2 changes: 1 addition & 1 deletion src/joycontrolstick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ void JoyControlStick::deleteButtons()

if (button != nullptr)
{
delete button;
button->deleteLater();
button = nullptr;
}
}
Expand Down
13 changes: 0 additions & 13 deletions src/joydpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ JoyDPad::JoyDPad(int index, int originset, SetJoystick *parentSet, QObject *pare
connect(&directionDelayTimer, &QTimer::timeout, this, &JoyDPad::dpadDirectionChangeEvent);
}

JoyDPad::~JoyDPad()
{
QHashIterator<int, JoyDPadButton *> iter(buttons);
while (iter.hasNext())
{
JoyDPadButton *button = iter.next().value();
delete button;
button = nullptr;
}

buttons.clear();
}

JoyDPadButton *JoyDPad::getJoyButton(int index_local) { return buttons.value(index_local); }

void JoyDPad::populateButtons()
Expand Down
1 change: 0 additions & 1 deletion src/joydpad.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class JoyDPad : public QObject

public:
explicit JoyDPad(int index, int originset, SetJoystick *parentSet, QObject *parent);
~JoyDPad();

enum JoyMode
{
Expand Down
2 changes: 1 addition & 1 deletion src/joytabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ void JoyTabWidget::removeSetButtons(SetJoystick *set)
while (current_layout && ((child = current_layout->takeAt(0)) != nullptr))
{
current_layout->removeWidget(child->widget());
delete child->widget();
child->widget()->deleteLater();
delete child;
child = nullptr;
}
Expand Down
Loading