Skip to content

Instantly share code, notes, and snippets.

@kcoul
Created August 26, 2020 06:28
Show Gist options
  • Save kcoul/b6b95d0ea8bf00e33fb37943a8c2cfb1 to your computer and use it in GitHub Desktop.
Save kcoul/b6b95d0ea8bf00e33fb37943a8c2cfb1 to your computer and use it in GitHub Desktop.
diff --git a/Source/CartManager.cpp b/Source/CartManager.cpp
index 946f7ea..59e5da4 100644
--- a/Source/CartManager.cpp
+++ b/Source/CartManager.cpp
@@ -167,7 +167,7 @@ void CartManager::buttonClicked(juce::Button *buttonThatWasClicked) {
}
if ( buttonThatWasClicked == loadButton ) {
- FileChooser fc ("Import original DX sysex...", File::nonexistent, "*.syx;*.SYX;*.*", 1);
+ FileChooser fc ("Import original DX sysex...", File::getSpecialLocation(File::SpecialLocationType::userDocumentsDirectory), "*.syx;*.SYX;*.*", 1);
if ( fc.browseForFileToOpen())
mainWindow->loadCart(fc.getResult());
diff --git a/Source/DXLookNFeel.cpp b/Source/DXLookNFeel.cpp
index a75805e..d94a129 100644
--- a/Source/DXLookNFeel.cpp
+++ b/Source/DXLookNFeel.cpp
@@ -78,7 +78,7 @@ DXLookNFeel::DXLookNFeel() {
if ( ! dexedTheme.existsAsFile() )
return;
- XmlElement *root = XmlDocument::parse(dexedTheme);
+ std::unique_ptr<XmlElement> root = XmlDocument::parse(dexedTheme);
if ( root == NULL )
return;
@@ -150,8 +150,6 @@ DXLookNFeel::DXLookNFeel() {
continue;
}
}
-
- delete root;
}
Typeface::Ptr DXLookNFeel::getTypefaceForFont(const Font &) {
diff --git a/Source/PluginData.cpp b/Source/PluginData.cpp
index 867d309..ad1fdfb 100644
--- a/Source/PluginData.cpp
+++ b/Source/PluginData.cpp
@@ -357,7 +357,7 @@ void DexedAudioProcessor::setStateInformation(const void* source, int sizeInByte
// whose contents will have been created by the getStateInformation() call.
// used to LOAD plugin state
- ScopedPointer<XmlElement> root(getXmlFromBinary(source, sizeInBytes));
+ std::unique_ptr<XmlElement> root(getXmlFromBinary(source, sizeInBytes));
if (root == nullptr) {
TRACE("unkown state format");
diff --git a/Source/SysexComm.cpp b/Source/SysexComm.cpp
index 4b3bde3..e4c63b2 100644
--- a/Source/SysexComm.cpp
+++ b/Source/SysexComm.cpp
@@ -36,11 +36,7 @@ SysexComm::SysexComm() {
SysexComm::~SysexComm() {
if ( input != NULL ) {
input->stop();
- delete input;
}
-
- if ( output != NULL )
- delete output;
}
String SysexComm::getInput() {
@@ -53,7 +49,6 @@ bool SysexComm::setInput(String target) {
if ( input != NULL ) {
input->stop();
- delete input;
input = NULL;
}
@@ -95,7 +90,6 @@ String SysexComm::getOutput() {
bool SysexComm::setOutput(String target) {
if ( output != NULL ) {
- delete output;
output = NULL;
}
inputOutput = false;
diff --git a/Source/SysexComm.h b/Source/SysexComm.h
index 478bae0..3deaaf1 100644
--- a/Source/SysexComm.h
+++ b/Source/SysexComm.h
@@ -24,8 +24,8 @@
#include "../JuceLibraryCode/JuceHeader.h"
class SysexComm {
- MidiInput *input;
- MidiOutput *output;
+ std::unique_ptr<MidiInput> input;
+ std::unique_ptr<MidiOutput> output;
String inputName;
String outputName;
int sysexChl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment