Browse Source

Misc ScopedPointer changes to start using reset() and get() rather than assignments and casts (part of an ongoing drift towards more std::unique_ptr compatibility)

tags/2021-05-28
jules 7 years ago
parent
commit
2dc9316420
100 changed files with 460 additions and 439 deletions
  1. +5
    -5
      examples/DSPDemo/Source/Main.cpp
  2. +1
    -2
      examples/DSPDemo/Source/MainComponent.cpp
  3. +2
    -2
      examples/Demo/Source/Demos/AudioLatencyDemo.cpp
  4. +2
    -4
      examples/Demo/Source/Demos/AudioPlaybackDemo.cpp
  5. +1
    -1
      examples/Demo/Source/Demos/AudioRecordingDemo.cpp
  6. +2
    -2
      examples/Demo/Source/Demos/ChildProcessDemo.cpp
  7. +1
    -1
      examples/Demo/Source/Demos/MidiDemo.cpp
  8. +7
    -7
      examples/Demo/Source/Demos/OpenGLDemo.cpp
  9. +3
    -3
      examples/Demo/Source/Demos/OpenGLDemo2D.cpp
  10. +1
    -1
      examples/Demo/Source/Demos/UnitTestsDemo.cpp
  11. +3
    -3
      examples/Demo/Source/Demos/XMLandJSONDemo.cpp
  12. +1
    -1
      examples/Demo/Source/Main.cpp
  13. +5
    -5
      examples/Demo/Source/MainWindow.cpp
  14. +7
    -9
      extras/Projucer/Source/Application/Windows/jucer_AboutWindowComponent.h
  15. +3
    -3
      extras/Projucer/Source/Application/Windows/jucer_ApplicationUsageDataWindowComponent.h
  16. +1
    -1
      extras/Projucer/Source/Application/Windows/jucer_EditorColourSchemeWindowComponent.h
  17. +1
    -1
      extras/Projucer/Source/Application/Windows/jucer_FloatingToolWindow.h
  18. +13
    -13
      extras/Projucer/Source/Application/jucer_Application.cpp
  19. +10
    -10
      extras/Projucer/Source/Application/jucer_AutoUpdater.cpp
  20. +3
    -3
      extras/Projucer/Source/Application/jucer_CommandLine.cpp
  21. +5
    -5
      extras/Projucer/Source/Application/jucer_MainWindow.cpp
  22. +1
    -1
      extras/Projucer/Source/Application/jucer_MainWindow.h
  23. +2
    -2
      extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h
  24. +2
    -2
      extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h
  25. +1
    -1
      extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp
  26. +2
    -2
      extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.h
  27. +2
    -2
      extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h
  28. +4
    -4
      extras/Projucer/Source/ComponentEditor/Documents/jucer_ButtonDocument.cpp
  29. +1
    -1
      extras/Projucer/Source/ComponentEditor/Documents/jucer_ComponentDocument.h
  30. +4
    -5
      extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp
  31. +3
    -3
      extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutineEditor.cpp
  32. +1
    -1
      extras/Projucer/Source/ComponentEditor/UI/jucer_TestComponent.cpp
  33. +1
    -1
      extras/Projucer/Source/ComponentEditor/jucer_BinaryResources.cpp
  34. +1
    -1
      extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp
  35. +2
    -2
      extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp
  36. +1
    -1
      extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.cpp
  37. +3
    -3
      extras/Projucer/Source/Licenses/jucer_LicenseController.cpp
  38. +2
    -2
      extras/Projucer/Source/Licenses/jucer_LicenseThread.h
  39. +5
    -6
      extras/Projucer/Source/Licenses/jucer_LicenseWebview.h
  40. +6
    -6
      extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp
  41. +1
    -1
      extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineServer.cpp
  42. +3
    -3
      extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h
  43. +4
    -4
      extras/Projucer/Source/Project/UI/Sidebar/jucer_TabComponents.h
  44. +1
    -1
      extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h
  45. +8
    -8
      extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp
  46. +1
    -1
      extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.h
  47. +1
    -1
      extras/Projucer/Source/Project/jucer_Project.cpp
  48. +1
    -1
      extras/Projucer/Source/Project/jucer_Project.h
  49. +1
    -1
      extras/Projucer/Source/Settings/jucer_StoredSettings.h
  50. +3
    -3
      extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp
  51. +2
    -2
      extras/Projucer/Source/Utility/UI/jucer_UserSettingsPopup.h
  52. +12
    -15
      extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.cpp
  53. +1
    -1
      extras/Projucer/Source/Wizards/jucer_NewProjectWizardComponent.h
  54. +1
    -1
      extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h
  55. +21
    -17
      modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp
  56. +8
    -8
      modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp
  57. +3
    -3
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  58. +2
    -2
      modules/juce_audio_formats/format/juce_AudioFormatReader.cpp
  59. +1
    -1
      modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp
  60. +2
    -2
      modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp
  61. +2
    -2
      modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp
  62. +26
    -27
      modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp
  63. +3
    -3
      modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp
  64. +40
    -40
      modules/juce_core/containers/juce_OwnedArray.h
  65. +1
    -1
      modules/juce_core/files/juce_DirectoryIterator.cpp
  66. +1
    -1
      modules/juce_core/javascript/juce_Javascript.cpp
  67. +2
    -2
      modules/juce_core/memory/juce_OptionalScopedPointer.h
  68. +69
    -11
      modules/juce_core/memory/juce_ScopedPointer.h
  69. +6
    -6
      modules/juce_core/misc/juce_StdFunctionCompat.cpp
  70. +3
    -3
      modules/juce_core/native/juce_mac_Network.mm
  71. +2
    -2
      modules/juce_core/native/juce_posix_NamedPipe.cpp
  72. +3
    -3
      modules/juce_core/native/juce_posix_SharedCode.h
  73. +1
    -1
      modules/juce_core/zip/juce_ZipFile.cpp
  74. +8
    -9
      modules/juce_data_structures/app_properties/juce_ApplicationProperties.cpp
  75. +1
    -1
      modules/juce_data_structures/app_properties/juce_ApplicationProperties.h
  76. +1
    -1
      modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp
  77. +27
    -35
      modules/juce_data_structures/undomanager/juce_UndoManager.cpp
  78. +2
    -2
      modules/juce_data_structures/undomanager/juce_UndoManager.h
  79. +5
    -5
      modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp
  80. +4
    -4
      modules/juce_events/interprocess/juce_InterprocessConnection.cpp
  81. +2
    -2
      modules/juce_events/interprocess/juce_InterprocessConnection.h
  82. +2
    -2
      modules/juce_events/interprocess/juce_InterprocessConnectionServer.cpp
  83. +3
    -3
      modules/juce_events/messages/juce_ApplicationBase.cpp
  84. +1
    -1
      modules/juce_events/messages/juce_MessageManager.cpp
  85. +9
    -9
      modules/juce_graphics/colour/juce_FillType.cpp
  86. +4
    -4
      modules/juce_graphics/native/juce_RenderingHelpers.h
  87. +2
    -22
      modules/juce_gui_basics/buttons/juce_Button.cpp
  88. +13
    -13
      modules/juce_gui_basics/buttons/juce_Button.h
  89. +1
    -2
      modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp
  90. +2
    -2
      modules/juce_gui_basics/commands/juce_ApplicationCommandManager.h
  91. +4
    -4
      modules/juce_gui_basics/components/juce_Component.cpp
  92. +1
    -1
      modules/juce_gui_basics/components/juce_Component.h
  93. +1
    -1
      modules/juce_gui_basics/drawables/juce_DrawablePath.cpp
  94. +1
    -1
      modules/juce_gui_basics/drawables/juce_DrawableShape.cpp
  95. +2
    -2
      modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp
  96. +2
    -2
      modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp
  97. +1
    -1
      modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp
  98. +1
    -1
      modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp
  99. +2
    -2
      modules/juce_gui_basics/layout/juce_MultiDocumentPanel.cpp
  100. +1
    -1
      modules/juce_gui_basics/layout/juce_MultiDocumentPanel.h

+ 5
- 5
examples/DSPDemo/Source/Main.cpp View File

@@ -27,7 +27,7 @@
#include "Main.h"
DSPSamplesApplication::DSPSamplesApplication()
: TimeSliceThread ("Audio File Reader Thread"), demoIndex (-1)
: TimeSliceThread ("Audio File Reader Thread")
{
loopState.addListener (this);
}
@@ -50,7 +50,7 @@ void DSPSamplesApplication::shutdown()
stop();
audioDeviceManager.removeAudioCallback (&audioSourcePlayer);
waitForThreadToExit (10000);
mainWindow = nullptr;
mainWindow.reset();
}
//==============================================================================
@@ -68,8 +68,8 @@ bool DSPSamplesApplication::loadFile (const File& fileToPlay)
audioSourcePlayer.setSource (nullptr);
mainWindow->setTransportSource (nullptr);
transportSource = nullptr;
readerSource = nullptr;
transportSource.reset();
readerSource.reset();
reader = formatManager.createReaderFor (fileToPlay);
@@ -125,7 +125,7 @@ void DSPSamplesApplication::init()
}
audioSourcePlayer.setSource (nullptr);
currentDemo = nullptr;
currentDemo.reset();
if (currentDemo == nullptr)
if (auto demo = Demo::getList()[demoIndex])


+ 1
- 2
examples/DSPDemo/Source/MainComponent.cpp View File

@@ -239,8 +239,7 @@ void MainContentComponent::initParameters()
{
auto& parameters = DSPSamplesApplication::getApp().getCurrentDemoParameters();
if (parametersComponent != nullptr)
parametersComponent = nullptr;
parametersComponent.reset();
if (parameters.size() > 0)
addAndMakeVisible (parametersComponent = new DemoParametersComponent (parameters));


+ 2
- 2
examples/Demo/Source/Demos/AudioLatencyDemo.cpp View File

@@ -328,8 +328,8 @@ public:
{
MainAppWindow::getSharedAudioDeviceManager().removeAudioCallback (liveAudioScroller);
startTestButton.removeListener (this);
latencyTester = nullptr;
liveAudioScroller = nullptr;
latencyTester.reset();
liveAudioScroller.reset();
}
void startTest()


+ 2
- 4
examples/Demo/Source/Demos/AudioPlaybackDemo.cpp View File

@@ -361,11 +361,9 @@ private:
// unload the previous file source and delete it..
transportSource.stop();
transportSource.setSource (nullptr);
currentAudioFileSource = nullptr;
currentAudioFileSource.reset();
AudioFormatReader* reader = formatManager.createReaderFor (audioFile);
if (reader != nullptr)
if (auto* reader = formatManager.createReaderFor (audioFile))
{
currentAudioFileSource = new AudioFormatReaderSource (reader, true);


+ 1
- 1
examples/Demo/Source/Demos/AudioRecordingDemo.cpp View File

@@ -95,7 +95,7 @@ public:
// Now we can delete the writer object. It's done in this order because the deletion could
// take a little time while remaining data gets flushed to disk, so it's best to avoid blocking
// the audio callback while this happens.
threadedWriter = nullptr;
threadedWriter.reset();
}
bool isRecording() const


+ 2
- 2
examples/Demo/Source/Demos/ChildProcessDemo.cpp View File

@@ -84,7 +84,7 @@ public:
~ChildProcessDemo()
{
masterProcess = nullptr;
masterProcess.reset();
}
void paint (Graphics& g) override
@@ -134,7 +134,7 @@ public:
{
if (masterProcess != nullptr)
{
masterProcess = nullptr;
masterProcess.reset();
logMessage ("Child process killed");
}
}


+ 1
- 1
examples/Demo/Source/Demos/MidiDemo.cpp View File

@@ -183,7 +183,7 @@ private:
//==============================================================================
void setMidiOutput (int index)
{
currentMidiOutput = nullptr;
currentMidiOutput.reset();
if (MidiOutput::getDevices() [index].isNotEmpty())
{


+ 7
- 7
examples/Demo/Source/Demos/OpenGLDemo.cpp View File

@@ -642,10 +642,10 @@ struct OpenGLDemoClasses
void freeAllContextObjects()
{
shape = nullptr;
shader = nullptr;
attributes = nullptr;
uniforms = nullptr;
shape.reset();
shader.reset();
attributes.reset();
uniforms.reset();
texture.release();
}
@@ -832,9 +832,9 @@ struct OpenGLDemoClasses
&& newShader->addFragmentShader (OpenGLHelpers::translateFragmentShaderToV3 (newFragmentShader))
&& newShader->link())
{
shape = nullptr;
attributes = nullptr;
uniforms = nullptr;
shape.reset();
attributes.reset();
uniforms.reset();
shader = newShader;
shader->use();


+ 3
- 3
examples/Demo/Source/Demos/OpenGLDemo2D.cpp View File

@@ -69,7 +69,7 @@ public:
~OpenGL2DShaderDemo()
{
shader = nullptr;
shader.reset();
}
void paint (Graphics& g) override
@@ -78,7 +78,7 @@ public:
if (shader == nullptr || shader->getFragmentShaderCode() != fragmentCode)
{
shader = nullptr;
shader.reset();
if (fragmentCode.isNotEmpty())
{
@@ -89,7 +89,7 @@ public:
if (result.failed())
{
statusLabel.setText (result.getErrorMessage(), dontSendNotification);
shader = nullptr;
shader.reset();
}
}
}


+ 1
- 1
examples/Demo/Source/Demos/UnitTestsDemo.cpp View File

@@ -180,7 +180,7 @@ struct UnitTestClasses
if (currentTestThread != nullptr)
{
currentTestThread->stopThread (15000);
currentTestThread = nullptr;
currentTestThread.reset();
}
}


+ 3
- 3
examples/Demo/Source/Demos/XMLandJSONDemo.cpp View File

@@ -296,14 +296,14 @@ private:
{
// clear the current tree
resultsTree.setRootItem (nullptr);
rootItem = nullptr;
rootItem.reset();
// try and parse the editor's contents
switch (typeBox.getSelectedItemIndex())
{
case xml: rootItem = rebuildXml(); break;
case json: rootItem = rebuildJson(); break;
default: rootItem = nullptr; break;
default: rootItem.reset(); break;
}
// if we have a valid TreeViewItem hide any old error messages and set our TreeView to use it
@@ -318,7 +318,7 @@ private:
/** Parses the editors contects as XML. */
TreeViewItem* rebuildXml()
{
parsedXml = nullptr;
parsedXml.reset();
XmlDocument doc (codeDocument.getAllContent());
parsedXml = doc.getDocumentElement();


+ 1
- 1
examples/Demo/Source/Main.cpp View File

@@ -51,7 +51,7 @@ public:
void shutdown() override
{
// Do your application's shutdown code here..
mainWindow = nullptr;
mainWindow.reset();
}
//==============================================================================


+ 5
- 5
examples/Demo/Source/MainWindow.cpp View File

@@ -134,7 +134,7 @@ public:
void clearCurrentDemo()
{
currentDemo = nullptr;
currentDemo.reset();
}
void resized() override
@@ -202,7 +202,7 @@ public:
{
if (auto* selectedDemoType = JuceDemoTypeBase::getDemoTypeList() [lastRowSelected])
{
currentDemo = nullptr;
currentDemo.reset();
addAndMakeVisible (currentDemo = selectedDemoType->createComponent());
currentDemo->setName (selectedDemoType->name);
resized();
@@ -618,9 +618,9 @@ MainAppWindow::~MainAppWindow()
{
contentComponent->clearCurrentDemo();
clearContentComponent();
contentComponent = nullptr;
applicationCommandManager = nullptr;
sharedAudioDeviceManager = nullptr;
contentComponent.reset();
applicationCommandManager.reset();
sharedAudioDeviceManager.reset();
#if JUCE_OPENGL
openGLContext.detach();


+ 7
- 9
extras/Projucer/Source/Application/Windows/jucer_AboutWindowComponent.h View File

@@ -41,7 +41,7 @@ public:
bool showPurchaseButton = false;
#if ! JUCER_ENABLE_GPL_MODE
if (LicenseController* controller = ProjucerApplication::getApp().licenseController)
if (auto* controller = ProjucerApplication::getApp().licenseController.get())
showPurchaseButton = (controller->getState().type != LicenseState::Type::indie
&& controller->getState().type != LicenseState::Type::pro);
#endif
@@ -130,19 +130,17 @@ private:
Rectangle<float> huckleberryLogoBounds;
Rectangle<float> juceLogoBounds;
ScopedPointer<Drawable> juceLogo
= Drawable::createFromImageData (BinaryData::juce_icon_png,
BinaryData::juce_icon_pngSize);
ScopedPointer<Drawable> juceLogo { Drawable::createFromImageData (BinaryData::juce_icon_png,
BinaryData::juce_icon_pngSize) };
ScopedPointer<Drawable> huckleberryLogo
= Drawable::createFromImageData (BinaryData::huckleberry_icon_svg,
BinaryData::huckleberry_icon_svgSize);
ScopedPointer<Drawable> huckleberryLogo { Drawable::createFromImageData (BinaryData::huckleberry_icon_svg,
BinaryData::huckleberry_icon_svgSize) };
void buttonClicked (Button* b) override
{
if (b == licenseButton)
if (b == licenseButton.get())
{
if (LicenseController* controller = ProjucerApplication::getApp().licenseController)
if (auto* controller = ProjucerApplication::getApp().licenseController.get())
controller->chooseNewLicense();
}
}


+ 3
- 3
extras/Projucer/Source/Application/Windows/jucer_ApplicationUsageDataWindowComponent.h View File

@@ -69,7 +69,7 @@ public:
{
addAndMakeVisible (shareApplicationUsageDataToggle = new ToggleButton());
LicenseController* controller = ProjucerApplication::getApp().licenseController;
auto* controller = ProjucerApplication::getApp().licenseController.get();
if (controller != nullptr && controller->getState().applicationUsageDataState == LicenseState::ApplicationUsageData::disabled)
shareApplicationUsageDataToggle->setToggleState (false, dontSendNotification);
@@ -90,7 +90,7 @@ public:
~ApplicationUsageDataWindowComponent()
{
if (LicenseController* controller = ProjucerApplication::getApp().licenseController)
if (auto* controller = ProjucerApplication::getApp().licenseController.get())
{
auto newApplicationUsageDataState = LicenseState::ApplicationUsageData::enabled;
@@ -160,7 +160,7 @@ private:
}
else if (b == upgradeLicenseButton)
{
if (LicenseController* controller = ProjucerApplication::getApp().licenseController)
if (auto* controller = ProjucerApplication::getApp().licenseController.get())
controller->chooseNewLicense();
}
}


+ 1
- 1
extras/Projucer/Source/Application/Windows/jucer_EditorColourSchemeWindowComponent.h View File

@@ -39,7 +39,7 @@ public:
else
content = new AppearanceEditor::EditorPanel();
changeContent (content);
changeContent (content.get());
}
void paint (Graphics& g) override


+ 1
- 1
extras/Projucer/Source/Application/Windows/jucer_FloatingToolWindow.h View File

@@ -68,7 +68,7 @@ struct FloatingToolWindow : public DialogWindow
void closeButtonPressed() override
{
owner = nullptr;
owner.reset();
}
bool escapeKeyPressed() override


+ 13
- 13
extras/Projucer/Source/Application/jucer_Application.cpp View File

@@ -195,31 +195,31 @@ void ProjucerApplication::shutdown()
Logger::writeToLog ("Server shutdown cleanly");
}
versionChecker = nullptr;
utf8Window = nullptr;
svgPathWindow = nullptr;
aboutWindow = nullptr;
pathsWindow = nullptr;
editorColourSchemeWindow = nullptr;
versionChecker.reset();
utf8Window.reset();
svgPathWindow.reset();
aboutWindow.reset();
pathsWindow.reset();
editorColourSchemeWindow.reset();
if (licenseController != nullptr)
{
licenseController->removeLicenseStatusChangedCallback (this);
licenseController = nullptr;
licenseController.reset();
}
mainWindowList.forceCloseAllWindows();
openDocumentManager.clear();
childProcessCache = nullptr;
childProcessCache.reset();
#if JUCE_MAC
MenuBarModel::setMacMainMenu (nullptr);
#endif
menuModel = nullptr;
commandManager = nullptr;
settings = nullptr;
menuModel.reset();
commandManager.reset();
settings.reset();
LookAndFeel::setDefaultLookAndFeel (nullptr);
@@ -739,7 +739,7 @@ void ProjucerApplication::showApplicationUsageDataAgreementPopup()
void ProjucerApplication::dismissApplicationUsageDataAgreementPopup()
{
if (applicationUsageDataWindow != nullptr)
applicationUsageDataWindow = nullptr;
applicationUsageDataWindow.reset();
}
void ProjucerApplication::showPathsWindow()
@@ -804,7 +804,7 @@ void ProjucerApplication::deleteLogger()
}
}
logger = nullptr;
logger.reset();
}
PropertiesFile::Options ProjucerApplication::getPropertyFileOptionsFor (const String& filename, bool isProjectSettings)


+ 10
- 10
extras/Projucer/Source/Application/jucer_AutoUpdater.cpp View File

@@ -308,16 +308,16 @@ public:
~UpdateUserDialog()
{
titleLabel = nullptr;
contentLabel = nullptr;
okButton = nullptr;
cancelButton = nullptr;
changeLogLabel = nullptr;
changeLog = nullptr;
overwriteLabel = nullptr;
overwritePath = nullptr;
overwriteButton = nullptr;
juceIcon = nullptr;
titleLabel.reset();
contentLabel.reset();
okButton.reset();
cancelButton.reset();
changeLogLabel.reset();
changeLog.reset();
overwriteLabel.reset();
overwritePath.reset();
overwriteButton.reset();
juceIcon.reset();
}
void paint (Graphics& g) override


+ 3
- 3
extras/Projucer/Source/Application/jucer_CommandLine.cpp View File

@@ -136,7 +136,7 @@ namespace
if (! project->loadFrom (projectFile, true))
{
project = nullptr;
project.reset();
throw CommandLineError ("Failed to load the project file: " + projectFile.getFullPathName());
}
}
@@ -148,7 +148,7 @@ namespace
Result error (justSaveResources ? project->saveResourcesOnly (project->getFile())
: project->saveProject (project->getFile(), true));
project = nullptr;
project.reset();
if (error.failed())
throw CommandLineError ("Error when saving: " + error.getErrorMessage());
@@ -302,7 +302,7 @@ namespace
ScopedPointer<FileOutputStream> out (temp.getFile().createOutputStream());
bool ok = out != nullptr && zip.writeToStream (*out, nullptr);
out = nullptr;
out.reset();
ok = ok && temp.overwriteTargetFileWithTemporary();
if (! ok)


+ 5
- 5
extras/Projucer/Source/Application/jucer_MainWindow.cpp View File

@@ -90,7 +90,7 @@ MainWindow::~MainWindow()
getGlobalProperties().setValue ("lastMainWindowPos", getWindowStateAsString());
clearContentComponent();
currentProject = nullptr;
currentProject.reset();
}
void MainWindow::createProjectContentCompIfNeeded()
@@ -155,7 +155,7 @@ bool MainWindow::closeProject (Project* project)
bool MainWindow::closeCurrentProject()
{
return currentProject == nullptr || closeProject (currentProject);
return currentProject == nullptr || closeProject (currentProject.get());
}
void MainWindow::setProject (Project* newProject)
@@ -200,17 +200,17 @@ bool MainWindow::openFile (const File& file)
{
ScopedPointer<Project> newDoc (new Project (file));
Result result (newDoc->loadFrom (file, true));
auto result = newDoc->loadFrom (file, true);
if (result.wasOk() && closeCurrentProject())
{
setProject (newDoc);
setProject (newDoc.get());
newDoc.release()->setChangedFlag (false);
jassert (getProjectContentComponent() != nullptr);
getProjectContentComponent()->reloadLastOpenDocuments();
if (Project* p = getProject())
if (auto* p = getProject())
p->updateDeprecatedProjectSettingsInteractively();
return true;


+ 1
- 1
extras/Projucer/Source/Application/jucer_MainWindow.h View File

@@ -50,7 +50,7 @@ public:
bool canOpenFile (const File& file) const;
bool openFile (const File& file);
void setProject (Project* newProject);
Project* getProject() const { return currentProject; }
Project* getProject() const { return currentProject.get(); }
void makeVisible();
void restoreWindowPosition();


+ 2
- 2
extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h View File

@@ -81,7 +81,7 @@ private:
{
facts.clear();
facts.add (file.getFullPathName());
drawable = nullptr;
drawable.reset();
{
ScopedPointer<InputStream> input (file.createInputStream());
@@ -94,7 +94,7 @@ private:
if (ImageFileFormat* format = ImageFileFormat::findImageFormatForStream (*input))
formatName = " " + format->getFormatName();
input = nullptr;
input.reset();
Image image (ImageCache::getFromFile (file));


+ 2
- 2
extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h View File

@@ -345,7 +345,7 @@ private:
|| underMouse->findParentComponentOfClass<ControlsComponent>() != nullptr))
return;
overlay = nullptr;
overlay.reset();
if (hasKeyboardFocus (true) && underMouse != nullptr
&& (underMouse == this || underMouse->isParentOf (this)))
@@ -372,7 +372,7 @@ private:
void hideOverlay()
{
stopTimer();
overlay = nullptr;
overlay.reset();
}
void focusLost (FocusChangeType) override


+ 1
- 1
extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp View File

@@ -474,7 +474,7 @@ void GenericCodeEditorComponent::showFindPanel()
void GenericCodeEditorComponent::hideFindPanel()
{
findPanel = nullptr;
findPanel.reset();
}
void GenericCodeEditorComponent::findSelection()


+ 2
- 2
extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.h View File

@@ -46,11 +46,11 @@ public:
bool hasFileBeenModifiedExternally() override { return modDetector.hasBeenModified(); }
void fileHasBeenRenamed (const File& newFile) override { modDetector.fileHasBeenRenamed (newFile); }
String getState() const override { return lastState != nullptr ? lastState->toString() : String(); }
void restoreState (const String& state) override { lastState = new CodeEditorComponent::State (state); }
void restoreState (const String& state) override { lastState.reset (new CodeEditorComponent::State (state)); }
File getCounterpartFile() const override
{
const File file (getFile());
auto file = getFile();
if (file.hasFileExtension (sourceFileExtensions))
{


+ 2
- 2
extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h View File

@@ -378,7 +378,7 @@ private:
|| jucerComp->getOwnerDocument() == nullptr
|| jucerComp->getFilename() != jucerComponentFile)
{
jucerComp = nullptr;
jucerComp.reset();
jucerComp = new TestComponent (ComponentTypeHandler::findParentDocument (this), 0, false);
jucerComp->setFilename (jucerComponentFile);
@@ -389,7 +389,7 @@ private:
}
else
{
jucerComp = nullptr;
jucerComp.reset();
}
resized();


+ 4
- 4
extras/Projucer/Source/ComponentEditor/Documents/jucer_ButtonDocument.cpp View File

@@ -113,14 +113,14 @@ PaintRoutine* ButtonDocument::getPaintRoutine (const int index) const
if (paintStatesEnabled [i])
{
if (index == n)
return paintRoutines [i];
else
++n;
return paintRoutines[i].get();
++n;
}
}
jassertfalse;
return 0;
return {};
}
void ButtonDocument::setStatePaintRoutineEnabled (const int index, bool b)


+ 1
- 1
extras/Projucer/Source/ComponentEditor/Documents/jucer_ComponentDocument.h View File

@@ -45,7 +45,7 @@ public:
StringArray getPaintRoutineNames() const { return StringArray ("Graphics"); }
PaintRoutine* getPaintRoutine (const int index) const { return index == 0 ? backgroundGraphics.get() : nullptr; }
ComponentLayout* getComponentLayout() const { return components; }
ComponentLayout* getComponentLayout() const { return components.get(); }
//==============================================================================
XmlElement* createXml() const;


+ 4
- 5
extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp View File

@@ -598,8 +598,7 @@ void JucerDocumentEditor::saveLastSelectedTab() const
{
if (document != nullptr)
{
auto* project = document->getCppDocument().getProject();
if (project != nullptr)
if (auto* project = document->getCppDocument().getProject())
{
auto& projectProps = project->getStoredProperties();
@@ -617,7 +616,7 @@ void JucerDocumentEditor::saveLastSelectedTab() const
child->setAttribute ("tab", tabbedComponent.getCurrentTabIndex());
projectProps.setValue ("GUIComponentsLastTab", root);
projectProps.setValue ("GUIComponentsLastTab", root.get());
}
}
}
@@ -626,10 +625,10 @@ void JucerDocumentEditor::restoreLastSelectedTab()
{
if (document != nullptr)
{
auto* project = document->getCppDocument().getProject();
if (project != nullptr)
if (auto* project = document->getCppDocument().getProject())
{
ScopedPointer<XmlElement> root (project->getStoredProperties().getXmlValue ("GUIComponentsLastTab"));
if (root != nullptr)
{
auto* child = root->getChildByName (document->getCppFile().getFileName());


+ 3
- 3
extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutineEditor.cpp View File

@@ -154,7 +154,7 @@ void PaintRoutineEditor::visibilityChanged()
void PaintRoutineEditor::refreshAllElements()
{
for (int i = getNumChildComponents(); --i >= 0;)
if (PaintElement* const e = dynamic_cast<PaintElement*> (getChildComponent (i)))
if (auto* e = dynamic_cast<PaintElement*> (getChildComponent (i)))
if (! graphics.containsElement (e))
removeChildComponent (e);
@@ -162,7 +162,7 @@ void PaintRoutineEditor::refreshAllElements()
for (int i = graphics.getNumElements(); --i >= 0;)
{
PaintElement* const e = graphics.getElement (i);
auto* e = graphics.getElement (i);
addAndMakeVisible (e);
@@ -268,7 +268,7 @@ void PaintRoutineEditor::filesDropped (const StringArray& filenames, int x, int
if (d != nullptr)
{
d = nullptr;
d.reset();
document.beginTransaction();


+ 1
- 1
extras/Projucer/Source/ComponentEditor/UI/jucer_TestComponent.cpp View File

@@ -94,7 +94,7 @@ void TestComponent::setFilename (const String& newName)
{
recursiveFiles.add (newFile.getFullPathName());
loadedDocument = nullptr;
loadedDocument.reset();
filename = newName;
lastModificationTime = findFile().getLastModificationTime();


+ 1
- 1
extras/Projucer/Source/ComponentEditor/jucer_BinaryResources.cpp View File

@@ -121,7 +121,7 @@ void BinaryResources::add (const String& name, const String& originalFileName, c
r->originalFilename = originalFileName;
r->data = data;
r->drawable = nullptr;
r->drawable.reset();
changed();
}


+ 1
- 1
extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp View File

@@ -420,7 +420,7 @@ Component* ComponentLayout::addNewComponent (ComponentTypeHandler* const type, i
c->getProperties().set ("id", nextCompUID++);
ScopedPointer<XmlElement> xml (type->createXmlFor (c, this));
c = nullptr;
c.reset();
c = addComponentFromXml (*xml, true);
String memberName (CodeHelpers::makeValidIdentifier (type->getClassName (c), true, true, false));


+ 2
- 2
extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp View File

@@ -564,7 +564,7 @@ bool JucerDocument::flushChangesToDocuments (Project* project)
cpp->getCodeDocument().replaceAllContent (cppTemplate);
}
userDocChangeTimer = nullptr;
userDocChangeTimer.reset();
return true;
}
@@ -771,7 +771,7 @@ public:
jucerDoc->setClassName (newFile.getFileNameWithoutExtension());
jucerDoc->flushChangesToDocuments (&project);
jucerDoc = nullptr;
jucerDoc.reset();
cpp->save();
header->save();


+ 1
- 1
extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.cpp View File

@@ -553,7 +553,7 @@ void PaintRoutine::dropImageAt (const File& f, int x, int y)
if (d != nullptr)
{
auto bounds = d->getDrawableBounds();
d = nullptr;
d.reset();
auto* newElement = addNewElement (ObjectTypes::createNewImageElement (this), -1, true);


+ 3
- 3
extras/Projucer/Source/Licenses/jucer_LicenseController.cpp View File

@@ -114,7 +114,7 @@ LicenseController::LicenseController()
LicenseController::~LicenseController()
{
#if !JUCER_ENABLE_GPL_MODE
thread = nullptr;
thread.reset();
closeWebview (-1);
#endif
}
@@ -155,7 +155,7 @@ void LicenseController::logout()
jassert (MessageManager::getInstance()->isThisTheMessageThread());
#if ! JUCER_ENABLE_GPL_MODE
thread = nullptr;
thread.reset();
updateState ({});
#if ! JUCE_LINUX
@@ -171,7 +171,7 @@ void LicenseController::chooseNewLicense()
jassert (MessageManager::getInstance()->isThisTheMessageThread());
#if ! JUCER_ENABLE_GPL_MODE
thread = nullptr;
thread.reset();
thread = new LicenseThread (*this, true);
#endif
}


+ 2
- 2
extras/Projucer/Source/Licenses/jucer_LicenseThread.h View File

@@ -174,7 +174,7 @@ struct LicenseThread : NetWorkerThread
if (statusCode == 200)
{
var result = JSON::parse (shared->readEntireStreamAsString());
shared = nullptr;
shared.reset();
auto newState = licenseStateFromJSON (result, stateToUpdate.authToken, stateToUpdate.avatar);
@@ -222,7 +222,7 @@ struct LicenseThread : NetWorkerThread
var json = JSON::parse (shared->withExtraHeaders (accessTokenHeader)
.readEntireStreamAsString());
shared = nullptr;
shared.reset();
if (auto* jsonLicenses = json.getArray())
{


+ 5
- 6
extras/Projucer/Source/Licenses/jucer_LicenseWebview.h View File

@@ -81,15 +81,14 @@ private:
struct Header : public Component, private LicenseController::StateChangedCallback,
private Button::Listener
{
Header ()
: avatarButton ("User Settings", &getIcons().user)
Header() : avatarButton ("User Settings", &getIcons().user)
{
setOpaque (true);
addChildComponent (avatarButton);
avatarButton.addListener (this);
if (LicenseController* licenseController = ProjucerApplication::getApp().licenseController)
if (auto* licenseController = ProjucerApplication::getApp().licenseController.get())
{
licenseController->addLicenseStatusChangedCallback (this);
licenseStateChanged (licenseController->getState());
@@ -100,7 +99,7 @@ private:
{
avatarButton.removeListener (this);
if (LicenseController* licenseController = ProjucerApplication::getApp().licenseController)
if (auto* licenseController = ProjucerApplication::getApp().licenseController.get())
licenseController->removeLicenseStatusChangedCallback (this);
}
@@ -128,9 +127,9 @@ private:
void buttonClicked (Button*) override
{
if (LicenseController* licenseController = ProjucerApplication::getApp().licenseController)
if (auto* licenseController = ProjucerApplication::getApp().licenseController.get())
{
const LicenseState::Type type = licenseController->getState().type;
auto type = licenseController->getState().type;
auto* content = new UserSettingsPopup (true);
content->setSize (200, (type == LicenseState::Type::noLicenseChosenYet ? 100 : 150));


+ 6
- 6
extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp View File

@@ -293,12 +293,12 @@ public:
if (isRunningApp && server != nullptr)
server->killServerWithoutMercy();
server = nullptr;
server.reset();
}
void restartServer()
{
server = nullptr;
server.reset();
server = new ClientIPC (owner);
sendRebuild();
}
@@ -578,7 +578,7 @@ CompileEngineChildProcess::~CompileEngineChildProcess()
{
ProjucerApplication::getApp().openDocumentManager.removeListener (this);
process = nullptr;
process.reset();
lastComponentList.clear();
}
@@ -588,7 +588,7 @@ void CompileEngineChildProcess::createProcess()
process = new ChildProcess (*this, project);
if (! process->openedOk)
process = nullptr;
process.reset();
updateAllEditors();
}
@@ -662,7 +662,7 @@ bool CompileEngineChildProcess::canKillApp() const
void CompileEngineChildProcess::killApp()
{
runningAppProcess = nullptr;
runningAppProcess.reset();
}
void CompileEngineChildProcess::handleAppLaunched()
@@ -675,7 +675,7 @@ void CompileEngineChildProcess::handleAppLaunched()
void CompileEngineChildProcess::handleAppQuit()
{
DBG ("handleAppQuit");
runningAppProcess = nullptr;
runningAppProcess.reset();
}
//==============================================================================


+ 1
- 1
extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineServer.cpp View File

@@ -162,7 +162,7 @@ public:
~ServerIPC()
{
zombieKiller = nullptr;
zombieKiller.reset();
if (dll.isLoaded())
dll.projucer_deleteBuilder (liveCodeBuilder);


+ 3
- 3
extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h View File

@@ -69,12 +69,12 @@ public:
Icon getIcon() const override
{
return getIconForExporter (exporter).withColour (getContentColour (true));
return getIconForExporter (exporter.get()).withColour (getContentColour (true));
}
void showDocument() override
{
showSettingsPage (new SettingsComp (exporter));
showSettingsPage (new SettingsComp (exporter.get()));
}
void deleteItem() override
@@ -142,7 +142,7 @@ public:
void itemDropped (const DragAndDropTarget::SourceDetails& dragSourceDetails, int insertIndex) override
{
const int oldIndex = indexOfConfig (dragSourceDetails.description.toString().fromLastOccurrenceOf ("||", false, false));
auto oldIndex = indexOfConfig (dragSourceDetails.description.toString().fromLastOccurrenceOf ("||", false, false));
if (oldIndex >= 0)
configListTree.moveChild (oldIndex, insertIndex, project.getUndoManagerFor (configListTree));


+ 4
- 4
extras/Projucer/Source/Project/UI/Sidebar/jucer_TabComponents.h View File

@@ -201,10 +201,10 @@ public:
~ConcertinaTreeComponent()
{
treeToDisplay = nullptr;
addButton = nullptr;
findPanel = nullptr;
settingsButton = nullptr;
treeToDisplay.reset();
addButton.reset();
findPanel.reset();
settingsButton.reset();
}
void resized() override


+ 1
- 1
extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h View File

@@ -98,7 +98,7 @@ public:
if (existingComponentToUpdate == nullptr
|| dynamic_cast<FileOptionComponent*> (existing.get())->item != child)
{
existing = nullptr;
existing.reset();
existing = new FileOptionComponent (child, dynamic_cast<ListBoxHeader*> (list.getHeaderComponent()));
}
}


+ 8
- 8
extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp View File

@@ -99,11 +99,11 @@ ProjectContentComponent::~ProjectContentComponent()
ProjucerApplication::getApp().openDocumentManager.removeListener (this);
logo = nullptr;
header = nullptr;
logo.reset();
header.reset();
setProject (nullptr);
contentView = nullptr;
fileNameLabel = nullptr;
contentView.reset();
fileNameLabel.reset();
removeChildComponent (&bubbleMessage);
jassert (getNumChildComponents() <= 1);
}
@@ -178,8 +178,8 @@ void ProjectContentComponent::setProject (Project* newProject)
if (project != nullptr)
project->removeChangeListener (this);
contentView = nullptr;
resizerBar = nullptr;
contentView.reset();
resizerBar.reset();
deleteProjectTabs();
project = newProject;
@@ -391,7 +391,7 @@ bool ProjectContentComponent::showDocument (OpenDocumentManager::Document* doc,
void ProjectContentComponent::hideEditor()
{
currentDocument = nullptr;
contentView = nullptr;
contentView.reset();
if (fileNameLabel != nullptr)
fileNameLabel->setVisible (false);
@@ -416,7 +416,7 @@ bool ProjectContentComponent::setEditorComponent (Component* editor,
{
if (editor != nullptr)
{
contentView = nullptr;
contentView.reset();
if (doc == nullptr)
{


+ 1
- 1
extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.h View File

@@ -67,7 +67,7 @@ public:
void hideEditor();
bool setEditorComponent (Component* editor, OpenDocumentManager::Document* doc);
Component* getEditorComponentContent() const;
Component* getEditorComponent() const { return contentView; }
Component* getEditorComponent() const { return contentView.get(); }
Component& getSidebarComponent() { return sidebarTabs; }
bool goToPreviousFile();


+ 1
- 1
extras/Projucer/Source/Project/jucer_Project.cpp View File

@@ -407,7 +407,7 @@ Result Project::loadDocument (const File& file)
return Result::fail ("The document contains errors and couldn't be parsed!");
registerRecentFile (file);
enabledModulesList = nullptr;
enabledModulesList.reset();
projectRoot = newTree;
removeDefunctExporters();


+ 1
- 1
extras/Projucer/Source/Project/jucer_Project.h View File

@@ -297,7 +297,7 @@ public:
bool next();
ProjectExporter& operator*() const { return *exporter; }
ProjectExporter* operator->() const { return exporter; }
ProjectExporter* operator->() const { return exporter.get(); }
ScopedPointer<ProjectExporter> exporter;
int index;


+ 1
- 1
extras/Projucer/Source/Settings/jucer_StoredSettings.h View File

@@ -84,7 +84,7 @@ private:
propertyFiles.getUnchecked (0)->setValue (isProjectDefaults ? "PROJECT_DEFAULT_SETTINGS"
: "FALLBACK_PATHS",
data);
data.get());
}
void updateGlobalPreferences();


+ 3
- 3
extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp View File

@@ -54,10 +54,10 @@ void TreePanelBase::saveOpenness()
{
if (project != nullptr)
{
const ScopedPointer<XmlElement> opennessState (tree.getOpennessState (true));
ScopedPointer<XmlElement> opennessState (tree.getOpennessState (true));
if (opennessState != nullptr)
project->getStoredProperties().setValue (opennessStateKey, opennessState);
project->getStoredProperties().setValue (opennessStateKey, opennessState.get());
else
project->getStoredProperties().removeValue (opennessStateKey);
}
@@ -269,5 +269,5 @@ void JucerTreeViewBase::itemDoubleClicked (const MouseEvent&)
void JucerTreeViewBase::cancelDelayedSelectionTimer()
{
delayedSelectionTimer = nullptr;
delayedSelectionTimer.reset();
}

+ 2
- 2
extras/Projucer/Source/Utility/UI/jucer_UserSettingsPopup.h View File

@@ -72,7 +72,7 @@ public:
switchLicenseButton->addListener (this);
}
if (LicenseController* controller = ProjucerApplication::getApp().licenseController)
if (auto* controller = ProjucerApplication::getApp().licenseController.get())
licenseStateChanged (controller->getState());
#endif
}
@@ -120,7 +120,7 @@ private:
else if (b == switchLicenseButton)
{
dismissCalloutBox();
if (LicenseController* controller = ProjucerApplication::getApp().licenseController)
if (auto* controller = ProjucerApplication::getApp().licenseController.get())
controller->chooseNewLicense();
}
}


+ 12
- 15
extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.cpp View File

@@ -53,23 +53,23 @@ struct NewProjectWizardClasses
return 9;
}
static NewProjectWizard* createWizardType (int index)
static ScopedPointer<NewProjectWizard> createWizardType (int index)
{
switch (index)
{
case 0: return new NewProjectWizardClasses::GUIAppWizard();
case 1: return new NewProjectWizardClasses::AnimatedAppWizard();
case 2: return new NewProjectWizardClasses::OpenGLAppWizard();
case 3: return new NewProjectWizardClasses::ConsoleAppWizard();
case 4: return new NewProjectWizardClasses::AudioAppWizard();
case 5: return new NewProjectWizardClasses::AudioPluginAppWizard();
case 6: return new NewProjectWizardClasses::StaticLibraryWizard();
case 7: return new NewProjectWizardClasses::DynamicLibraryWizard();
case 8: return new NewProjectWizardClasses::BlankAppWizard();
case 0: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::GUIAppWizard());
case 1: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::AnimatedAppWizard());
case 2: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::OpenGLAppWizard());
case 3: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::ConsoleAppWizard());
case 4: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::AudioAppWizard());
case 5: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::AudioPluginAppWizard());
case 6: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::StaticLibraryWizard());
case 7: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::DynamicLibraryWizard());
case 8: return ScopedPointer<NewProjectWizard> (new NewProjectWizardClasses::BlankAppWizard());
default: jassertfalse; break;
}
return nullptr;
return {};
}
static StringArray getWizardNames()
@@ -77,10 +77,7 @@ struct NewProjectWizardClasses
StringArray s;
for (int i = 0; i < getNumWizards(); ++i)
{
ScopedPointer<NewProjectWizard> wiz (createWizardType (i));
s.add (wiz->getName());
}
s.add (createWizardType (i)->getName());
return s;
}


+ 1
- 1
extras/Projucer/Source/Wizards/jucer_NewProjectWizardComponent.h View File

@@ -519,7 +519,7 @@ private:
TextButton cancelButton { TRANS("Cancel") };
ModulesFolderPathBox modulesPathBox;
NewProjectWizardClasses::NewProjectWizard* createWizard()
ScopedPointer<NewProjectWizardClasses::NewProjectWizard> createWizard()
{
return createWizardType (projectType.getSelectedItemIndex());
}


+ 1
- 1
extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h View File

@@ -144,7 +144,7 @@ public:
for (int i = 0; i < numWizardButtons; ++i)
{
ScopedPointer<NewProjectWizard> wizard (createWizardType (i));
auto wizard = createWizardType (i);
TemplateOptionButton* b = new TemplateOptionButton (wizard->getName(),
TemplateOptionButton::ImageFitted,


+ 21
- 17
modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp View File

@@ -101,8 +101,8 @@ AudioDeviceManager::AudioDeviceManager()
AudioDeviceManager::~AudioDeviceManager()
{
currentAudioDevice = nullptr;
defaultMidiOutput = nullptr;
currentAudioDevice.reset();
defaultMidiOutput.reset();
}
//==============================================================================
@@ -316,7 +316,7 @@ String AudioDeviceManager::initialiseFromXML (const XmlElement& xml,
String AudioDeviceManager::initialiseWithDefaultDevices (int numInputChannelsNeeded,
int numOutputChannelsNeeded)
{
lastExplicitSettings = nullptr;
lastExplicitSettings.reset();
return initialise (numInputChannelsNeeded, numOutputChannelsNeeded,
nullptr, false, String(), nullptr);
@@ -389,7 +389,7 @@ void AudioDeviceManager::getAudioDeviceSetup (AudioDeviceSetup& setup) const
void AudioDeviceManager::deleteCurrentDevice()
{
currentAudioDevice = nullptr;
currentAudioDevice.reset();
currentSetup.inputDeviceName.clear();
currentSetup.outputDeviceName.clear();
}
@@ -588,13 +588,13 @@ void AudioDeviceManager::stopDevice()
if (currentAudioDevice != nullptr)
currentAudioDevice->stop();
testSound = nullptr;
testSound.reset();
}
void AudioDeviceManager::closeAudioDevice()
{
stopDevice();
currentAudioDevice = nullptr;
currentAudioDevice.reset();
}
void AudioDeviceManager::restartLastAudioDevice()
@@ -705,14 +705,14 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat
if (callbacks.size() > 0)
{
const double callbackStartTime = Time::getMillisecondCounterHiRes();
auto callbackStartTime = Time::getMillisecondCounterHiRes();
tempBuffer.setSize (jmax (1, numOutputChannels), jmax (1, numSamples), false, false, true);
callbacks.getUnchecked(0)->audioDeviceIOCallback (inputChannelData, numInputChannels,
outputChannelData, numOutputChannels, numSamples);
float** const tempChans = tempBuffer.getArrayOfWritePointers();
auto** tempChans = tempBuffer.getArrayOfWritePointers();
for (int i = callbacks.size(); --i > 0;)
{
@@ -721,14 +721,14 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat
for (int chan = 0; chan < numOutputChannels; ++chan)
{
if (const float* const src = tempChans [chan])
if (float* const dst = outputChannelData [chan])
if (auto* src = tempChans [chan])
if (auto* dst = outputChannelData [chan])
for (int j = 0; j < numSamples; ++j)
dst[j] += src[j];
}
}
const double msTaken = Time::getMillisecondCounterHiRes() - callbackStartTime;
auto msTaken = Time::getMillisecondCounterHiRes() - callbackStartTime;
const double filterAmount = 0.2;
cpuUsageMs += filterAmount * (msTaken - cpuUsageMs);
@@ -743,16 +743,17 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat
if (testSound != nullptr)
{
const int numSamps = jmin (numSamples, testSound->getNumSamples() - testSoundPosition);
const float* const src = testSound->getReadPointer (0, testSoundPosition);
auto numSamps = jmin (numSamples, testSound->getNumSamples() - testSoundPosition);
auto* src = testSound->getReadPointer (0, testSoundPosition);
for (int i = 0; i < numOutputChannels; ++i)
for (int j = 0; j < numSamps; ++j)
outputChannelData [i][j] += src[j];
testSoundPosition += numSamps;
if (testSoundPosition >= testSound->getNumSamples())
testSound = nullptr;
testSound.reset();
}
}
@@ -761,8 +762,8 @@ void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device
cpuUsageMs = 0;
xruns = 0;
const double sampleRate = device->getCurrentSampleRate();
const int blockSize = device->getCurrentBufferSizeSamples();
auto sampleRate = device->getCurrentSampleRate();
auto blockSize = device->getCurrentBufferSizeSamples();
if (sampleRate > 0.0 && blockSize > 0)
{
@@ -772,6 +773,7 @@ void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device
{
const ScopedLock sl (audioCallbackLock);
for (int i = callbacks.size(); --i >= 0;)
callbacks.getUnchecked(i)->audioDeviceAboutToStart (device);
}
@@ -787,6 +789,7 @@ void AudioDeviceManager::audioDeviceStoppedInt()
sendChangeMessage();
const ScopedLock sl (audioCallbackLock);
for (int i = callbacks.size(); --i >= 0;)
callbacks.getUnchecked(i)->audioDeviceStopped();
}
@@ -794,6 +797,7 @@ void AudioDeviceManager::audioDeviceStoppedInt()
void AudioDeviceManager::audioDeviceErrorInt (const String& message)
{
const ScopedLock sl (audioCallbackLock);
for (int i = callbacks.size(); --i >= 0;)
callbacks.getUnchecked(i)->audioDeviceError (message);
}
@@ -903,7 +907,7 @@ void AudioDeviceManager::setDefaultMidiOutput (const String& deviceName)
for (int i = oldCallbacks.size(); --i >= 0;)
oldCallbacks.getUnchecked(i)->audioDeviceStopped();
defaultMidiOutput = nullptr;
defaultMidiOutput.reset();
defaultMidiOutputName = deviceName;
if (deviceName.isNotEmpty())


+ 8
- 8
modules/juce_audio_devices/native/juce_mac_CoreMidi.cpp View File

@@ -318,8 +318,7 @@ namespace CoreMidiHelpers
class MidiPortAndCallback
{
public:
MidiPortAndCallback (MidiInputCallback& cb)
: input (nullptr), active (false), callback (cb), concatenator (2048)
MidiPortAndCallback (MidiInputCallback& cb) : callback (cb)
{
}
@@ -332,18 +331,19 @@ namespace CoreMidiHelpers
activeCallbacks.removeFirstMatchingValue (this);
}
if (portAndEndpoint != 0 && portAndEndpoint->port != 0)
if (portAndEndpoint != nullptr && portAndEndpoint->port != 0)
CHECK_ERROR (MIDIPortDisconnectSource (portAndEndpoint->port, portAndEndpoint->endPoint));
}
void handlePackets (const MIDIPacketList* const pktlist)
{
const double time = Time::getMillisecondCounterHiRes() * 0.001;
auto time = Time::getMillisecondCounterHiRes() * 0.001;
const ScopedLock sl (callbackLock);
if (activeCallbacks.contains (this) && active)
{
const MIDIPacket* packet = &pktlist->packet[0];
auto* packet = &pktlist->packet[0];
for (unsigned int i = 0; i < pktlist->numPackets; ++i)
{
@@ -355,13 +355,13 @@ namespace CoreMidiHelpers
}
}
MidiInput* input;
MidiInput* input = nullptr;
ScopedPointer<MidiPortAndEndpoint> portAndEndpoint;
volatile bool active;
volatile bool active = false;
private:
MidiInputCallback& callback;
MidiDataConcatenator concatenator;
MidiDataConcatenator concatenator { 2048 };
};
static void midiInputProc (const MIDIPacketList* pktlist, void* readProcRefCon, void* /*srcConnRefCon*/)


+ 3
- 3
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -1749,8 +1749,8 @@ namespace WavFileHelpers
outStream.release();
bool ok = writer->writeFromAudioReader (*reader, 0, -1);
writer = nullptr;
reader = nullptr;
writer.reset();
reader.reset();
return ok && tempFile.overwriteTargetFileWithTemporary();
}
@@ -1769,7 +1769,7 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai
{
auto bwavPos = reader->bwavChunkStart;
auto bwavSize = reader->bwavSize;
reader = nullptr;
reader.reset();
if (bwavSize > 0)
{


+ 2
- 2
modules/juce_audio_formats/format/juce_AudioFormatReader.cpp View File

@@ -389,7 +389,7 @@ bool MemoryMappedAudioFormatReader::mapSectionOfFile (Range<int64> samplesToMap)
{
if (map == nullptr || samplesToMap != mappedSection)
{
map = nullptr;
map.reset();
const Range<int64> fileRange (sampleToFilePos (samplesToMap.getStart()),
sampleToFilePos (samplesToMap.getEnd()));
@@ -397,7 +397,7 @@ bool MemoryMappedAudioFormatReader::mapSectionOfFile (Range<int64> samplesToMap)
map = new MemoryMappedFile (file, fileRange, MemoryMappedFile::readOnly);
if (map->getData() == nullptr)
map = nullptr;
map.reset();
else
mappedSection = Range<int64> (jmax ((int64) 0, filePosToSample (map->getRange().getStart() + (bytesPerFrame - 1))),
jmin (lengthInSamples, filePosToSample (map->getRange().getEnd())));


+ 1
- 1
modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp View File

@@ -113,7 +113,7 @@ void AudioProcessorEditor::setResizable (const bool shouldBeResizable, const boo
}
else
{
resizableCorner = nullptr;
resizableCorner.reset();
}
}
}


+ 2
- 2
modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp View File

@@ -1177,8 +1177,8 @@ void AudioProcessorGraph::buildRenderingSequence()
{
{
const ScopedLock sl (getCallbackLock());
renderSequenceFloat = nullptr;
renderSequenceDouble = nullptr;
renderSequenceFloat.reset();
renderSequenceDouble.reset();
}
for (auto* node : nodes)


+ 2
- 2
modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp View File

@@ -385,7 +385,7 @@ public:
if (pool != nullptr)
{
pool->removeAllJobs (true, 60000);
pool = nullptr;
pool.reset();
}
}
@@ -580,7 +580,7 @@ void PluginListComponent::scanFinished (const StringArray& failedFiles)
for (int i = 0; i < failedFiles.size(); ++i)
shortNames.add (File::createFileWithoutCheckingPath (failedFiles[i]).getFileName());
currentScanner = nullptr; // mustn't delete this before using the failed files array
currentScanner.reset(); // mustn't delete this before using the failed files array
if (shortNames.size() > 0)
AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon,


+ 26
- 27
modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp View File

@@ -459,8 +459,8 @@ public:
}
else
{
outputChanLabel = nullptr;
outputChanList = nullptr;
outputChanLabel.reset();
outputChanList.reset();
}
if (setup.maxNumInputChannels > 0
@@ -480,8 +480,8 @@ public:
}
else
{
inputChanLabel = nullptr;
inputChanList = nullptr;
inputChanLabel.reset();
inputChanList.reset();
}
updateSampleRateComboBox (currentDevice);
@@ -491,15 +491,15 @@ public:
{
jassert (setup.manager->getCurrentAudioDevice() == nullptr); // not the correct device type!
inputChanLabel = nullptr;
outputChanLabel = nullptr;
sampleRateLabel = nullptr;
bufferSizeLabel = nullptr;
inputChanLabel.reset();
outputChanLabel.reset();
sampleRateLabel.reset();
bufferSizeLabel.reset();
inputChanList = nullptr;
outputChanList = nullptr;
sampleRateDropDown = nullptr;
bufferSizeDropDown = nullptr;
inputChanList.reset();
outputChanList.reset();
sampleRateDropDown.reset();
bufferSizeDropDown.reset();
if (outputDeviceDropDown != nullptr)
outputDeviceDropDown->setSelectedId (-1, dontSendNotification);
@@ -574,8 +574,8 @@ private:
void updateControlPanelButton()
{
AudioIODevice* const currentDevice = setup.manager->getCurrentAudioDevice();
showUIButton = nullptr;
auto* currentDevice = setup.manager->getCurrentAudioDevice();
showUIButton.reset();
if (currentDevice != nullptr && currentDevice->hasControlPanel())
{
@@ -606,7 +606,7 @@ private:
}
}
resetDeviceButton = nullptr;
resetDeviceButton.reset();
}
void updateOutputsComboBox()
@@ -1033,9 +1033,9 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
}
else
{
midiInputsList = nullptr;
midiInputsLabel = nullptr;
bluetoothButton = nullptr;
midiInputsList.reset();
midiInputsLabel.reset();
bluetoothButton.reset();
}
if (showMidiOutputSelector)
@@ -1048,8 +1048,8 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
}
else
{
midiOutputSelector = nullptr;
midiOutputLabel = nullptr;
midiOutputSelector.reset();
midiOutputLabel.reset();
}
deviceManager.addChangeListener (this);
@@ -1123,7 +1123,7 @@ void AudioDeviceSelectorComponent::comboBoxChanged (ComboBox* comboBoxThatHasCha
{
if (AudioIODeviceType* const type = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown->getSelectedId() - 1])
{
audioDeviceSettingsComp = nullptr;
audioDeviceSettingsComp.reset();
deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true);
updateAllControls(); // needed in case the type hasn't actually changed
}
@@ -1153,11 +1153,10 @@ void AudioDeviceSelectorComponent::updateAllControls()
|| audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType())
{
audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType();
audioDeviceSettingsComp = nullptr;
audioDeviceSettingsComp.reset();
if (AudioIODeviceType* const type
= deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == nullptr
? 0 : deviceTypeDropDown->getSelectedId() - 1])
if (auto* type = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == nullptr
? 0 : deviceTypeDropDown->getSelectedId() - 1])
{
AudioDeviceSetupDetails details;
details.manager = &deviceManager;
@@ -1167,7 +1166,7 @@ void AudioDeviceSelectorComponent::updateAllControls()
details.maxNumOutputChannels = maxOutputChannels;
details.useStereoPairs = showChannelsAsStereoPairs;
AudioDeviceSettingsPanel* sp = new AudioDeviceSettingsPanel (*type, details, hideAdvancedOptionsWithButton);
auto* sp = new AudioDeviceSettingsPanel (*type, details, hideAdvancedOptionsWithButton);
audioDeviceSettingsComp = sp;
addAndMakeVisible (sp);
sp->updateAllControls();
@@ -1185,7 +1184,7 @@ void AudioDeviceSelectorComponent::updateAllControls()
{
midiOutputSelector->clear();
const StringArray midiOuts (MidiOutput::getDevices());
auto midiOuts = MidiOutput::getDevices();
midiOutputSelector->addItem (getNoDeviceString(), -1);
midiOutputSelector->addSeparator();


+ 3
- 3
modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp View File

@@ -120,7 +120,7 @@ public:
sampleRate = reader->sampleRate;
if (lengthInSamples <= 0 || isFullyLoaded())
reader = nullptr;
reader.reset();
else
owner.cache.getTimeSliceThread().addTimeSliceClient (this);
}
@@ -155,7 +155,7 @@ public:
void releaseResources()
{
const ScopedLock sl (readerLock);
reader = nullptr;
reader.reset();
}
int useTimeSlice() override
@@ -557,7 +557,7 @@ AudioThumbnail::~AudioThumbnail()
void AudioThumbnail::clear()
{
source = nullptr;
source.reset();
const ScopedLock sl (lock);
clearChannelData();
}


+ 40
- 40
modules/juce_core/containers/juce_OwnedArray.h View File

@@ -51,7 +51,6 @@ public:
//==============================================================================
/** Creates an empty array. */
OwnedArray() noexcept
: numUsed (0)
{
}
@@ -139,7 +138,7 @@ public:
if (isPositiveAndBelow (index, numUsed))
{
jassert (data.elements != nullptr);
return data.elements [index];
return data.elements[index];
}
return nullptr;
@@ -154,7 +153,7 @@ public:
{
const ScopedLockType lock (getLock());
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
return data.elements [index];
return data.elements[index];
}
/** Returns a pointer to the first object in the array.
@@ -169,7 +168,7 @@ public:
if (numUsed > 0)
{
jassert (data.elements != nullptr);
return data.elements [0];
return data.elements[0];
}
return nullptr;
@@ -187,7 +186,7 @@ public:
if (numUsed > 0)
{
jassert (data.elements != nullptr);
return data.elements [numUsed - 1];
return data.elements[numUsed - 1];
}
return nullptr;
@@ -233,8 +232,8 @@ public:
int indexOf (const ObjectClass* objectToLookFor) const noexcept
{
const ScopedLockType lock (getLock());
ObjectClass* const* e = data.elements.get();
ObjectClass* const* const end_ = e + numUsed;
auto** e = data.elements.get();
auto** end_ = e + numUsed;
for (; e != end_; ++e)
if (objectToLookFor == *e)
@@ -251,8 +250,8 @@ public:
bool contains (const ObjectClass* objectToLookFor) const noexcept
{
const ScopedLockType lock (getLock());
ObjectClass* const* e = data.elements.get();
ObjectClass* const* const end_ = e + numUsed;
auto** e = data.elements.get();
auto** end_ = e + numUsed;
for (; e != end_; ++e)
if (objectToLookFor == *e)
@@ -279,7 +278,7 @@ public:
const ScopedLockType lock (getLock());
data.ensureAllocatedSize (numUsed + 1);
jassert (data.elements != nullptr);
data.elements [numUsed++] = newObject;
data.elements[numUsed++] = newObject;
return newObject;
}
@@ -314,8 +313,8 @@ public:
data.ensureAllocatedSize (numUsed + 1);
jassert (data.elements != nullptr);
ObjectClass** const e = data.elements + indexToInsertAt;
const int numToMove = numUsed - indexToInsertAt;
auto** e = data.elements + indexToInsertAt;
auto numToMove = numUsed - indexToInsertAt;
if (numToMove > 0)
memmove (e + 1, e, sizeof (ObjectClass*) * (size_t) numToMove);
@@ -345,12 +344,12 @@ public:
{
const ScopedLockType lock (getLock());
data.ensureAllocatedSize (numUsed + numberOfElements);
ObjectClass** insertPos = data.elements;
auto* insertPos = data.elements.get();
if (isPositiveAndBelow (indexToInsertAt, numUsed))
{
insertPos += indexToInsertAt;
const size_t numberToMove = (size_t) (numUsed - indexToInsertAt);
auto numberToMove = (size_t) (numUsed - indexToInsertAt);
memmove (insertPos + numberOfElements, insertPos, numberToMove * sizeof (ObjectClass*));
}
else
@@ -410,18 +409,18 @@ public:
{
if (deleteOldElement)
{
toDelete = data.elements [indexToChange];
toDelete = data.elements[indexToChange];
if (toDelete == newObject)
toDelete.release();
}
data.elements [indexToChange] = newObject;
data.elements[indexToChange] = newObject;
}
else
{
data.ensureAllocatedSize (numUsed + 1);
data.elements [numUsed++] = newObject;
data.elements[numUsed++] = newObject;
}
}
}
@@ -465,7 +464,7 @@ public:
while (--numElementsToAdd >= 0)
{
data.elements [numUsed] = arrayToAddFrom.getUnchecked (startIndex++);
data.elements[numUsed] = arrayToAddFrom.getUnchecked (startIndex++);
++numUsed;
}
}
@@ -505,7 +504,7 @@ public:
jassert (numElementsToAdd <= 0 || data.elements != nullptr);
while (--numElementsToAdd >= 0)
data.elements [numUsed++] = createCopyIfNotNull (arrayToAddFrom.getUnchecked (startIndex++));
data.elements[numUsed++] = createCopyIfNotNull (arrayToAddFrom.getUnchecked (startIndex++));
}
/** Inserts a new object into the array assuming that the array is sorted.
@@ -552,14 +551,15 @@ public:
while (s < e)
{
if (comparator.compareElements (objectToLookFor, data.elements [s]) == 0)
if (comparator.compareElements (objectToLookFor, data.elements[s]) == 0)
return s;
const int halfway = (s + e) / 2;
auto halfway = (s + e) / 2;
if (halfway == s)
break;
if (comparator.compareElements (objectToLookFor, data.elements [halfway]) >= 0)
if (comparator.compareElements (objectToLookFor, data.elements[halfway]) >= 0)
s = halfway;
else
e = halfway;
@@ -588,13 +588,13 @@ public:
if (isPositiveAndBelow (indexToRemove, numUsed))
{
ObjectClass** const e = data.elements + indexToRemove;
auto** e = data.elements + indexToRemove;
if (deleteObject)
toDelete = *e;
toDelete.reset (*e);
--numUsed;
const int numToShift = numUsed - indexToRemove;
auto numToShift = numUsed - indexToRemove;
if (numToShift > 0)
memmove (e, e + 1, sizeof (ObjectClass*) * (size_t) numToShift);
@@ -621,7 +621,7 @@ public:
if (isPositiveAndBelow (indexToRemove, numUsed))
{
ObjectClass** const e = data.elements + indexToRemove;
auto** e = data.elements + indexToRemove;
removedItem = *e;
--numUsed;
@@ -648,7 +648,7 @@ public:
void removeObject (const ObjectClass* objectToRemove, bool deleteObject = true)
{
const ScopedLockType lock (getLock());
ObjectClass** const e = data.elements.get();
auto** e = data.elements.get();
for (int i = 0; i < numUsed; ++i)
{
@@ -676,7 +676,7 @@ public:
void removeRange (int startIndex, int numberToRemove, bool deleteObjects = true)
{
const ScopedLockType lock (getLock());
const int endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
auto endIndex = jlimit (0, numUsed, startIndex + numberToRemove);
startIndex = jlimit (0, numUsed, startIndex);
if (endIndex > startIndex)
@@ -685,19 +685,19 @@ public:
{
for (int i = startIndex; i < endIndex; ++i)
{
ContainerDeletePolicy<ObjectClass>::destroy (data.elements [i]);
data.elements [i] = nullptr; // (in case one of the destructors accesses this array and hits a dangling pointer)
ContainerDeletePolicy<ObjectClass>::destroy (data.elements[i]);
data.elements[i] = nullptr; // (in case one of the destructors accesses this array and hits a dangling pointer)
}
}
const int rangeSize = endIndex - startIndex;
ObjectClass** e = data.elements + startIndex;
int numToShift = numUsed - endIndex;
auto rangeSize = endIndex - startIndex;
auto** e = data.elements + startIndex;
auto numToShift = numUsed - endIndex;
numUsed -= rangeSize;
while (--numToShift >= 0)
{
*e = e [rangeSize];
*e = e[rangeSize];
++e;
}
@@ -736,8 +736,8 @@ public:
if (isPositiveAndBelow (index1, numUsed)
&& isPositiveAndBelow (index2, numUsed))
{
std::swap (data.elements [index1],
data.elements [index2]);
std::swap (data.elements[index1],
data.elements[index2]);
}
}
@@ -765,7 +765,7 @@ public:
if (! isPositiveAndBelow (newIndex, numUsed))
newIndex = numUsed - 1;
ObjectClass* const value = data.elements [currentIndex];
auto* value = data.elements[currentIndex];
if (newIndex > currentIndex)
{
@@ -780,7 +780,7 @@ public:
sizeof (ObjectClass*) * (size_t) (currentIndex - newIndex));
}
data.elements [newIndex] = value;
data.elements[newIndex] = value;
}
}
}
@@ -882,12 +882,12 @@ public:
private:
//==============================================================================
ArrayAllocationBase <ObjectClass*, TypeOfCriticalSectionToUse> data;
int numUsed;
int numUsed = 0;
void deleteAllObjects()
{
while (numUsed > 0)
ContainerDeletePolicy<ObjectClass>::destroy (data.elements [--numUsed]);
ContainerDeletePolicy<ObjectClass>::destroy (data.elements[--numUsed]);
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray)


+ 1
- 1
modules/juce_core/files/juce_DirectoryIterator.cpp View File

@@ -79,7 +79,7 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul
if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly))
return true;
subIterator = nullptr;
subIterator.reset();
}
String filename;


+ 1
- 1
modules/juce_core/javascript/juce_Javascript.cpp View File

@@ -1103,7 +1103,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
Expression* parseInPlaceOpExpression (ExpPtr& lhs)
{
ExpPtr rhs (parseExpression());
Expression* bareLHS = lhs; // careful - bare pointer is deliberately alised
Expression* bareLHS = lhs.get(); // careful - bare pointer is deliberately alised
return new SelfAssignment (location, bareLHS, new OpType (location, lhs, rhs));
}


+ 2
- 2
modules/juce_core/memory/juce_OptionalScopedPointer.h View File

@@ -98,7 +98,7 @@ public:
//==============================================================================
/** Returns the object that this pointer is managing. */
inline operator ObjectType*() const noexcept { return object; }
inline operator ObjectType*() const noexcept { return object.get(); }
/** Returns the object that this pointer is managing. */
inline ObjectType* get() const noexcept { return object; }
@@ -107,7 +107,7 @@ public:
inline ObjectType& operator*() const noexcept { return *object; }
/** Lets you access methods and properties of the object that this pointer is holding. */
inline ObjectType* operator->() const noexcept { return object; }
inline ObjectType* operator->() const noexcept { return object.get(); }
//==============================================================================
/** Removes the current object from this OptionalScopedPointer without deleting it.


+ 69
- 11
modules/juce_core/memory/juce_ScopedPointer.h View File

@@ -170,6 +170,12 @@ public:
}
}
/** Sets this pointer to a new object, deleting the old object that it was previously pointing to if there was one. */
void reset (ScopedPointer& newObject)
{
reset (newObject.release());
}
/** Detaches and returns the current object from this ScopedPointer without deleting it.
This will return the current object, and set the ScopedPointer to a null pointer.
*/
@@ -191,7 +197,7 @@ public:
/** If the pointer is non-null, this will attempt to return a new copy of the object that is pointed to.
If the pointer is null, this will safely return a nullptr.
*/
inline ObjectType* createCopy() const { return createCopyIfNotNull (object); }
inline ObjectType* createCopy() const { return createCopyIfNotNull (object); }
private:
//==============================================================================
@@ -206,22 +212,74 @@ private:
};
//==============================================================================
/** Compares a ScopedPointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
/** Compares a ScopedPointer with another pointer. */
template <typename ObjectType1, typename ObjectType2>
bool operator== (ObjectType1* pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept
{
return pointer1 == pointer2.get();
}
/** Compares a ScopedPointer with another pointer. */
template <typename ObjectType1, typename ObjectType2>
bool operator!= (ObjectType1* pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept
{
return pointer1 != pointer2.get();
}
/** Compares a ScopedPointer with another pointer. */
template <typename ObjectType1, typename ObjectType2>
bool operator== (const ScopedPointer<ObjectType1>& pointer1, ObjectType2* pointer2) noexcept
{
return pointer1.get() == pointer2;
}
/** Compares a ScopedPointer with another pointer. */
template <typename ObjectType1, typename ObjectType2>
bool operator!= (const ScopedPointer<ObjectType1>& pointer1, ObjectType2* pointer2) noexcept
{
return pointer1.get() != pointer2;
}
/** Compares a ScopedPointer with another pointer. */
template <typename ObjectType1, typename ObjectType2>
bool operator== (const ScopedPointer<ObjectType1>& pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept
{
return pointer1.get() == pointer2.get();
}
/** Compares a ScopedPointer with another pointer. */
template <typename ObjectType1, typename ObjectType2>
bool operator!= (const ScopedPointer<ObjectType1>& pointer1, const ScopedPointer<ObjectType2>& pointer2) noexcept
{
return pointer1.get() != pointer2.get();
}
/** Compares a ScopedPointer with a nullptr. */
template <class ObjectType>
bool operator== (const ScopedPointer<ObjectType>& pointer1, ObjectType* pointer2) noexcept
bool operator== (decltype (nullptr), const ScopedPointer<ObjectType>& pointer) noexcept
{
return static_cast<ObjectType*> (pointer1) == pointer2;
return pointer.get() == nullptr;
}
/** Compares a ScopedPointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
/** Compares a ScopedPointer with a nullptr. */
template <class ObjectType>
bool operator!= (decltype (nullptr), const ScopedPointer<ObjectType>& pointer) noexcept
{
return pointer.get() != nullptr;
}
/** Compares a ScopedPointer with a nullptr. */
template <class ObjectType>
bool operator== (const ScopedPointer<ObjectType>& pointer, decltype (nullptr)) noexcept
{
return pointer.get() == nullptr;
}
/** Compares a ScopedPointer with a nullptr. */
template <class ObjectType>
bool operator!= (const ScopedPointer<ObjectType>& pointer1, ObjectType* pointer2) noexcept
bool operator!= (const ScopedPointer<ObjectType>& pointer, decltype (nullptr)) noexcept
{
return static_cast<ObjectType*> (pointer1) != pointer2;
return pointer.get() != nullptr;
}
//==============================================================================


+ 6
- 6
modules/juce_core/misc/juce_StdFunctionCompat.cpp View File

@@ -176,7 +176,7 @@ public:
ScopedPointer<std::function<int()>> fStackTmp (new std::function<int()> (fStack));
std::function<int()> f1 (static_cast<std::function<int()>&&> (*fStackTmp));
fStackTmp = nullptr;
fStackTmp.reset();
expectEquals (f1(), 3);
ScopedPointer<std::function<int()>> fHeapTmp (new std::function<int()> (fHeap));
@@ -184,12 +184,12 @@ public:
if (*fHeapTmp)
expect (false);
fHeapTmp = nullptr;
fHeapTmp.reset();
expectEquals (f2(), FunctionTestsHelpers::BigData::bigDataSum);
ScopedPointer<std::function<int()>> fEmptyTmp (new std::function<int()>());
std::function<int()> f3 (static_cast<std::function<int()>&&> (*fEmptyTmp));
fEmptyTmp = nullptr;
fEmptyTmp.reset();
if (f3)
expect (false);
}
@@ -201,7 +201,7 @@ public:
ScopedPointer<std::function<int()>> fStackTmp (new std::function<int()> (fStack));
f1 = static_cast<std::function<int()>&&> (*fStackTmp);
fStackTmp = nullptr;
fStackTmp.reset();
expectEquals (f1(), 3);
std::function<int()> f2 (fStack);
@@ -210,13 +210,13 @@ public:
if (*fHeapTmp)
expect (false);
fHeapTmp = nullptr;
fHeapTmp.reset();
expectEquals (f2(), FunctionTestsHelpers::BigData::bigDataSum);
std::function<int()> f3 (fHeap);
ScopedPointer<std::function<int()>> fEmptyTmp (new std::function<int()>());
f3 = static_cast<std::function<int()>&&> (*fEmptyTmp);
fEmptyTmp = nullptr;
fEmptyTmp.reset();
if (f3)
expect (false);
}


+ 3
- 3
modules/juce_core/native/juce_mac_Network.mm View File

@@ -941,7 +941,7 @@ public:
~Pimpl()
{
connection = nullptr;
connection.reset();
}
bool connect (WebInputStream::Listener* webInputListener, int numRetries = 0)
@@ -963,12 +963,12 @@ public:
#if ! (JUCE_IOS || (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10))
if (numRetries == 0 && connection->nsUrlErrorCode == NSURLErrorNetworkConnectionLost)
{
connection = nullptr;
connection.reset();
return connect (webInputListener, ++numRetries);
}
#endif
connection = nullptr;
connection.reset();
return false;
}


+ 2
- 2
modules/juce_core/native/juce_posix_NamedPipe.cpp View File

@@ -191,7 +191,7 @@ void NamedPipe::close()
ignoreUnused (done);
ScopedWriteLock sl (lock);
pimpl = nullptr;
pimpl.reset();
}
}
@@ -211,7 +211,7 @@ bool NamedPipe::openInternal (const String& pipeName, const bool createPipe, boo
if (createPipe && ! pimpl->createFifos (mustNotExist))
{
pimpl = nullptr;
pimpl.reset();
return false;
}


+ 3
- 3
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -880,7 +880,7 @@ bool InterProcessLock::enter (const int timeOutMillisecs)
pimpl = new Pimpl (name, timeOutMillisecs);
if (pimpl->handle == 0)
pimpl = nullptr;
pimpl.reset();
}
else
{
@@ -898,7 +898,7 @@ void InterProcessLock::exit()
jassert (pimpl != nullptr);
if (pimpl != nullptr && --(pimpl->refCount) == 0)
pimpl = nullptr;
pimpl.reset();
}
//==============================================================================
@@ -1260,7 +1260,7 @@ bool ChildProcess::start (const StringArray& args, int streamFlags)
activeProcess = new ActiveProcess (args, streamFlags);
if (activeProcess->childPID == 0)
activeProcess = nullptr;
activeProcess.reset();
return activeProcess != nullptr;
}


+ 1
- 1
modules/juce_core/zip/juce_ZipFile.cpp View File

@@ -534,7 +534,7 @@ private:
uncompressedSize += bytesRead;
}
stream = nullptr;
stream.reset();
return true;
}


+ 8
- 9
modules/juce_data_structures/app_properties/juce_ApplicationProperties.cpp View File

@@ -28,7 +28,6 @@ namespace juce
{
ApplicationProperties::ApplicationProperties()
: commonSettingsAreReadOnly (0)
{
}
@@ -56,16 +55,16 @@ void ApplicationProperties::openFiles()
if (userProps == nullptr)
{
o.commonToAllUsers = false;
userProps = new PropertiesFile (o);
userProps.reset (new PropertiesFile (o));
}
if (commonProps == nullptr)
{
o.commonToAllUsers = true;
commonProps = new PropertiesFile (o);
commonProps.reset (new PropertiesFile (o));
}
userProps->setFallbackPropertySet (commonProps);
userProps->setFallbackPropertySet (commonProps.get());
}
}
@@ -74,7 +73,7 @@ PropertiesFile* ApplicationProperties::getUserSettings()
if (userProps == nullptr)
openFiles();
return userProps;
return userProps.get();
}
PropertiesFile* ApplicationProperties::getCommonSettings (const bool returnUserPropsIfReadOnly)
@@ -88,10 +87,10 @@ PropertiesFile* ApplicationProperties::getCommonSettings (const bool returnUserP
commonSettingsAreReadOnly = commonProps->save() ? -1 : 1;
if (commonSettingsAreReadOnly > 0)
return userProps;
return userProps.get();
}
return commonProps;
return commonProps.get();
}
bool ApplicationProperties::saveIfNeeded()
@@ -102,8 +101,8 @@ bool ApplicationProperties::saveIfNeeded()
void ApplicationProperties::closeFiles()
{
userProps = nullptr;
commonProps = nullptr;
userProps.reset();
commonProps.reset();
}
} // namespace juce

+ 1
- 1
modules/juce_data_structures/app_properties/juce_ApplicationProperties.h View File

@@ -122,7 +122,7 @@ private:
//==============================================================================
PropertiesFile::Options options;
ScopedPointer<PropertiesFile> userProps, commonProps;
int commonSettingsAreReadOnly;
int commonSettingsAreReadOnly = 0;
void openFiles();


+ 1
- 1
modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp View File

@@ -331,7 +331,7 @@ bool PropertiesFile::saveAsBinary()
out->writeString (values[i]);
}
out = nullptr;
out.reset();
if (tempFile.overwriteTargetFileWithTemporary())
{


+ 27
- 35
modules/juce_data_structures/undomanager/juce_UndoManager.cpp View File

@@ -36,8 +36,8 @@ struct UndoManager::ActionSet
bool perform() const
{
for (int i = 0; i < actions.size(); ++i)
if (! actions.getUnchecked(i)->perform())
for (auto* a : actions)
if (! a->perform())
return false;
return true;
@@ -56,8 +56,8 @@ struct UndoManager::ActionSet
{
int total = 0;
for (int i = actions.size(); --i >= 0;)
total += actions.getUnchecked(i)->getSizeInUnits();
for (auto* a : actions)
total += a->getSizeInUnits();
return total;
}
@@ -68,15 +68,9 @@ struct UndoManager::ActionSet
};
//==============================================================================
UndoManager::UndoManager (const int maxNumberOfUnitsToKeep,
const int minimumTransactions)
: totalUnitsStored (0),
nextIndex (0),
newTransaction (true),
reentrancyCheck (false)
UndoManager::UndoManager (int maxNumberOfUnitsToKeep, int minimumTransactions)
{
setMaxNumberOfStoredUnits (maxNumberOfUnitsToKeep,
minimumTransactions);
setMaxNumberOfStoredUnits (maxNumberOfUnitsToKeep, minimumTransactions);
}
UndoManager::~UndoManager()
@@ -97,11 +91,10 @@ int UndoManager::getNumberOfUnitsTakenUpByStoredCommands() const
return totalUnitsStored;
}
void UndoManager::setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
const int minimumTransactions)
void UndoManager::setMaxNumberOfStoredUnits (int maxUnits, int minTransactions)
{
maxNumUnitsToKeep = jmax (1, maxNumberOfUnitsToKeep);
minimumTransactionsToKeep = jmax (1, minimumTransactions);
maxNumUnitsToKeep = jmax (1, maxUnits);
minimumTransactionsToKeep = jmax (1, minTransactions);
}
//==============================================================================
@@ -118,7 +111,7 @@ bool UndoManager::perform (UndoableAction* const newAction, const String& action
return false;
}
bool UndoManager::perform (UndoableAction* const newAction)
bool UndoManager::perform (UndoableAction* newAction)
{
if (newAction != nullptr)
{
@@ -133,15 +126,15 @@ bool UndoManager::perform (UndoableAction* const newAction)
if (action->perform())
{
ActionSet* actionSet = getCurrentSet();
auto* actionSet = getCurrentSet();
if (actionSet != nullptr && ! newTransaction)
{
if (UndoableAction* const lastAction = actionSet->actions.getLast())
if (auto* lastAction = actionSet->actions.getLast())
{
if (UndoableAction* const coalescedAction = lastAction->createCoalescedAction (action))
if (auto coalescedAction = lastAction->createCoalescedAction (action.get()))
{
action = coalescedAction;
action.reset (coalescedAction);
totalUnitsStored -= lastAction->getSizeInUnits();
actionSet->actions.removeLast();
}
@@ -176,7 +169,7 @@ void UndoManager::moveFutureTransactionsToStash()
while (nextIndex < transactions.size())
{
ActionSet* removed = transactions.removeAndReturn (nextIndex);
auto* removed = transactions.removeAndReturn (nextIndex);
stashedFutureTransactions.add (removed);
totalUnitsStored -= removed->getTotalSize();
}
@@ -191,11 +184,10 @@ void UndoManager::restoreStashedFutureTransactions()
transactions.remove (nextIndex);
}
for (int i = 0; i < stashedFutureTransactions.size(); ++i)
for (auto* stashed : stashedFutureTransactions)
{
ActionSet* action = stashedFutureTransactions.removeAndReturn (i);
totalUnitsStored += action->getTotalSize();
transactions.add (action);
transactions.add (stashed);
totalUnitsStored += stashed->getTotalSize();
}
stashedFutureTransactions.clearQuick (false);
@@ -219,7 +211,7 @@ void UndoManager::dropOldTransactionsIfTooLarge()
void UndoManager::beginNewTransaction() noexcept
{
beginNewTransaction (String());
beginNewTransaction ({});
}
void UndoManager::beginNewTransaction (const String& actionName) noexcept
@@ -232,13 +224,13 @@ void UndoManager::setCurrentTransactionName (const String& newName) noexcept
{
if (newTransaction)
newTransactionName = newName;
else if (ActionSet* action = getCurrentSet())
else if (auto* action = getCurrentSet())
action->name = newName;
}
String UndoManager::getCurrentTransactionName() const noexcept
{
if (ActionSet* action = getCurrentSet())
if (auto* action = getCurrentSet())
return action->name;
return newTransactionName;
@@ -253,7 +245,7 @@ bool UndoManager::canRedo() const noexcept { return getNextSet() != nullptr
bool UndoManager::undo()
{
if (const ActionSet* const s = getCurrentSet())
if (auto* s = getCurrentSet())
{
const ScopedValueSetter<bool> setter (reentrancyCheck, true);
@@ -272,7 +264,7 @@ bool UndoManager::undo()
bool UndoManager::redo()
{
if (const ActionSet* const s = getNextSet())
if (auto* s = getNextSet())
{
const ScopedValueSetter<bool> setter (reentrancyCheck, true);
@@ -335,15 +327,15 @@ bool UndoManager::undoCurrentTransactionOnly()
void UndoManager::getActionsInCurrentTransaction (Array<const UndoableAction*>& actionsFound) const
{
if (! newTransaction)
if (const ActionSet* const s = getCurrentSet())
for (int i = 0; i < s->actions.size(); ++i)
actionsFound.add (s->actions.getUnchecked(i));
if (auto* s = getCurrentSet())
for (auto* a : s->actions)
actionsFound.add (a);
}
int UndoManager::getNumActionsInCurrentTransaction() const
{
if (! newTransaction)
if (const ActionSet* const s = getCurrentSet())
if (auto* s = getCurrentSet())
return s->actions.size();
return 0;


+ 2
- 2
modules/juce_data_structures/undomanager/juce_UndoManager.h View File

@@ -232,8 +232,8 @@ private:
friend struct ContainerDeletePolicy<ActionSet>;
OwnedArray<ActionSet> transactions, stashedFutureTransactions;
String newTransactionName;
int totalUnitsStored, maxNumUnitsToKeep, minimumTransactionsToKeep, nextIndex;
bool newTransaction, reentrancyCheck;
int totalUnitsStored = 0, maxNumUnitsToKeep = 0, minimumTransactionsToKeep = 0, nextIndex = 0;
bool newTransaction = true, reentrancyCheck = false;
ActionSet* getCurrentSet() const noexcept;
ActionSet* getNextSet() const noexcept;
void moveFutureTransactionsToStash();


+ 5
- 5
modules/juce_events/interprocess/juce_ConnectedChildProcess.cpp View File

@@ -128,7 +128,7 @@ ChildProcessMaster::~ChildProcessMaster()
{
sendMessageToSlave (MemoryBlock (killMessage, specialMessageSize));
connection->disconnect();
connection = nullptr;
connection.reset();
}
}
@@ -145,10 +145,10 @@ bool ChildProcessMaster::sendMessageToSlave (const MemoryBlock& mb)
bool ChildProcessMaster::launchSlaveProcess (const File& executable, const String& commandLineUniqueID, int timeoutMs, int streamFlags)
{
connection = nullptr;
connection.reset();
jassert (childProcess.kill());
const String pipeName ("p" + String::toHexString (Random().nextInt64()));
auto pipeName = "p" + String::toHexString (Random().nextInt64());
StringArray args;
args.add (executable.getFullPathName());
@@ -164,7 +164,7 @@ bool ChildProcessMaster::launchSlaveProcess (const File& executable, const Strin
return true;
}
connection = nullptr;
connection.reset();
}
return false;
@@ -257,7 +257,7 @@ bool ChildProcessSlave::initialiseFromCommandLine (const String& commandLine,
connection = new Connection (*this, pipeName, timeoutMs <= 0 ? defaultTimeoutMs : timeoutMs);
if (! connection->isConnected())
connection = nullptr;
connection.reset();
}
}


+ 4
- 4
modules/juce_events/interprocess/juce_InterprocessConnection.cpp View File

@@ -45,7 +45,7 @@ InterprocessConnection::~InterprocessConnection()
callbackConnectionState = false;
disconnect();
masterReference.clear();
thread = nullptr;
thread.reset();
}
//==============================================================================
@@ -65,7 +65,7 @@ bool InterprocessConnection::connectToSocket (const String& hostName,
return true;
}
socket = nullptr;
socket.reset();
return false;
}
@@ -121,8 +121,8 @@ void InterprocessConnection::disconnect()
void InterprocessConnection::deletePipeAndSocket()
{
const ScopedLock sl (pipeAndSocketLock);
socket = nullptr;
pipe = nullptr;
socket.reset();
pipe.reset();
}
bool InterprocessConnection::isConnected() const


+ 2
- 2
modules/juce_events/interprocess/juce_InterprocessConnection.h View File

@@ -122,10 +122,10 @@ public:
bool isConnected() const;
/** Returns the socket that this connection is using (or nullptr if it uses a pipe). */
StreamingSocket* getSocket() const noexcept { return socket; }
StreamingSocket* getSocket() const noexcept { return socket.get(); }
/** Returns the pipe that this connection is using (or nullptr if it uses a socket). */
NamedPipe* getPipe() const noexcept { return pipe; }
NamedPipe* getPipe() const noexcept { return pipe.get(); }
/** Returns the name of the machine at the other end of this connection.
This may return an empty string if the name is unknown.


+ 2
- 2
modules/juce_events/interprocess/juce_InterprocessConnectionServer.cpp View File

@@ -46,7 +46,7 @@ bool InterprocessConnectionServer::beginWaitingForSocket (const int portNumber,
return true;
}
socket = nullptr;
socket.reset();
return false;
}
@@ -58,7 +58,7 @@ void InterprocessConnectionServer::stop()
socket->close();
stopThread (4000);
socket = nullptr;
socket.reset();
}
int InterprocessConnectionServer::getBoundPort() const noexcept


+ 3
- 3
modules/juce_events/messages/juce_ApplicationBase.cpp View File

@@ -304,7 +304,7 @@ bool JUCEApplicationBase::initialiseApp()
#if JUCE_HANDLE_MULTIPLE_INSTANCES
if (multipleInstanceHandler != nullptr)
MessageManager::getInstance()->registerBroadcastListener (multipleInstanceHandler);
MessageManager::getInstance()->registerBroadcastListener (multipleInstanceHandler.get());
#endif
return true;
@@ -316,7 +316,7 @@ int JUCEApplicationBase::shutdownApp()
#if JUCE_HANDLE_MULTIPLE_INSTANCES
if (multipleInstanceHandler != nullptr)
MessageManager::getInstance()->deregisterBroadcastListener (multipleInstanceHandler);
MessageManager::getInstance()->deregisterBroadcastListener (multipleInstanceHandler.get());
#endif
JUCE_TRY
@@ -326,7 +326,7 @@ int JUCEApplicationBase::shutdownApp()
}
JUCE_CATCH_EXCEPTION
multipleInstanceHandler = nullptr;
multipleInstanceHandler.reset();
return getApplicationReturnValue();
}


+ 1
- 1
modules/juce_events/messages/juce_MessageManager.cpp View File

@@ -32,7 +32,7 @@ MessageManager::MessageManager() noexcept
MessageManager::~MessageManager() noexcept
{
broadcaster = nullptr;
broadcaster.reset();
doPlatformSpecificShutdown();


+ 9
- 9
modules/juce_graphics/colour/juce_FillType.cpp View File

@@ -37,13 +37,13 @@ FillType::FillType (Colour c) noexcept
{
}
FillType::FillType (const ColourGradient& gradient_)
: colour (0xff000000), gradient (new ColourGradient (gradient_))
FillType::FillType (const ColourGradient& g)
: colour (0xff000000), gradient (new ColourGradient (g))
{
}
FillType::FillType (const Image& image_, const AffineTransform& transform_) noexcept
: colour (0xff000000), image (image_), transform (transform_)
FillType::FillType (const Image& im, const AffineTransform& t) noexcept
: colour (0xff000000), image (im), transform (t)
{
}
@@ -106,7 +106,7 @@ bool FillType::operator!= (const FillType& other) const
void FillType::setColour (Colour newColour) noexcept
{
gradient = nullptr;
gradient.reset();
image = Image();
colour = newColour;
}
@@ -125,11 +125,11 @@ void FillType::setGradient (const ColourGradient& newGradient)
}
}
void FillType::setTiledImage (const Image& image_, const AffineTransform& transform_) noexcept
void FillType::setTiledImage (const Image& newImage, const AffineTransform& newTransform) noexcept
{
gradient = nullptr;
image = image_;
transform = transform_;
gradient.reset();
image = newImage;
transform = newTransform;
colour = Colours::black;
}


+ 4
- 4
modules/juce_graphics/native/juce_RenderingHelpers.h View File

@@ -297,10 +297,10 @@ public:
snapToIntegerCoordinate = typeface->isHinted();
glyph = glyphNumber;
const float fontHeight = font.getHeight();
edgeTable = typeface->getEdgeTableForGlyph (glyphNumber,
AffineTransform::scale (fontHeight * font.getHorizontalScale(),
fontHeight), fontHeight);
auto fontHeight = font.getHeight();
edgeTable.reset (typeface->getEdgeTableForGlyph (glyphNumber,
AffineTransform::scale (fontHeight * font.getHorizontalScale(),
fontHeight), fontHeight));
}
Font font;


+ 2
- 22
modules/juce_gui_basics/buttons/juce_Button.cpp View File

@@ -76,27 +76,7 @@ private:
};
//==============================================================================
Button::Button (const String& name)
: Component (name),
text (name),
buttonPressTime (0),
lastRepeatTime (0),
commandManagerToUse (nullptr),
autoRepeatDelay (-1),
autoRepeatSpeed (0),
autoRepeatMinimumDelay (-1),
radioGroupId (0),
connectedEdgeFlags (0),
commandID(),
buttonState (buttonNormal),
lastStatePainted (buttonNormal),
lastToggleState (false),
clickTogglesState (false),
needsToRelease (false),
needsRepainting (false),
isKeyDown (false),
triggerOnMouseDown (false),
generateTooltip (false)
Button::Button (const String& name) : Component (name), text (name)
{
callbackHelper = new CallbackHelper (*this);
@@ -112,7 +92,7 @@ Button::~Button()
commandManagerToUse->removeListener (callbackHelper);
isOn.removeListener (callbackHelper);
callbackHelper = nullptr;
callbackHelper.reset();
}
//==============================================================================


+ 13
- 13
modules/juce_gui_basics/buttons/juce_Button.h View File

@@ -479,21 +479,21 @@ private:
friend class CallbackHelper;
friend struct ContainerDeletePolicy<CallbackHelper>;
ScopedPointer<CallbackHelper> callbackHelper;
uint32 buttonPressTime, lastRepeatTime;
ApplicationCommandManager* commandManagerToUse;
int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay;
int radioGroupId, connectedEdgeFlags;
CommandID commandID;
ButtonState buttonState, lastStatePainted;
uint32 buttonPressTime = 0, lastRepeatTime = 0;
ApplicationCommandManager* commandManagerToUse = nullptr;
int autoRepeatDelay = -1, autoRepeatSpeed = 0, autoRepeatMinimumDelay = -1;
int radioGroupId = 0, connectedEdgeFlags = 0;
CommandID commandID = {};
ButtonState buttonState = buttonNormal, lastStatePainted = buttonNormal;
Value isOn;
bool lastToggleState;
bool clickTogglesState;
bool needsToRelease;
bool needsRepainting;
bool isKeyDown;
bool triggerOnMouseDown;
bool generateTooltip;
bool lastToggleState = false;
bool clickTogglesState = false;
bool needsToRelease = false;
bool needsRepainting = false;
bool isKeyDown = false;
bool triggerOnMouseDown = false;
bool generateTooltip = false;
void repeatTimerCallback();
bool keyStateChangedCallback();


+ 1
- 2
modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp View File

@@ -28,7 +28,6 @@ namespace juce
{
ApplicationCommandManager::ApplicationCommandManager()
: firstTarget (nullptr)
{
keyMappings = new KeyPressMappingSet (*this);
Desktop::getInstance().addFocusChangeListener (this);
@@ -37,7 +36,7 @@ ApplicationCommandManager::ApplicationCommandManager()
ApplicationCommandManager::~ApplicationCommandManager()
{
Desktop::getInstance().removeFocusChangeListener (this);
keyMappings = nullptr;
keyMappings.reset();
}
//==============================================================================


+ 2
- 2
modules/juce_gui_basics/commands/juce_ApplicationCommandManager.h View File

@@ -198,7 +198,7 @@ public:
@see KeyPressMappingSet
*/
KeyPressMappingSet* getKeyMappings() const noexcept { return keyMappings; }
KeyPressMappingSet* getKeyMappings() const noexcept { return keyMappings.get(); }
//==============================================================================
@@ -304,7 +304,7 @@ private:
OwnedArray<ApplicationCommandInfo> commands;
ListenerList<ApplicationCommandManagerListener> listeners;
ScopedPointer<KeyPressMappingSet> keyMappings;
ApplicationCommandTarget* firstTarget;
ApplicationCommandTarget* firstTarget = nullptr;
void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo&);
void handleAsyncUpdate() override;


+ 4
- 4
modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -853,7 +853,7 @@ void Component::setBufferedToImage (const bool shouldBeBuffered)
}
else
{
cachedImage = nullptr;
cachedImage.reset();
}
}
@@ -1334,7 +1334,7 @@ void Component::setTransform (const AffineTransform& newTransform)
if (affineTransform != nullptr)
{
repaint();
affineTransform = nullptr;
affineTransform.reset();
repaint();
sendMovedResizedMessages (false, false);
@@ -2812,7 +2812,7 @@ void Component::grabFocusInternal (const FocusChangeType cause, const bool canTr
if (traverser != nullptr)
{
auto* defaultComp = traverser->getDefaultComponent (this);
traverser = nullptr;
traverser.reset();
if (defaultComp != nullptr)
{
@@ -2859,7 +2859,7 @@ void Component::moveKeyboardFocusToSibling (const bool moveToNext)
{
auto* nextComp = moveToNext ? traverser->getNextComponent (this)
: traverser->getPreviousComponent (this);
traverser = nullptr;
traverser.reset();
if (nextComp != nullptr)
{


+ 1
- 1
modules/juce_gui_basics/components/juce_Component.h View File

@@ -2222,7 +2222,7 @@ public:
/** Returns the object that was set by setCachedComponentImage().
@see setCachedComponentImage
*/
CachedComponentImage* getCachedComponentImage() const noexcept { return cachedImage; }
CachedComponentImage* getCachedComponentImage() const noexcept { return cachedImage.get(); }
/** Sets a flag to indicate whether mouse drag events on this Component should be ignored when it is inside a
Viewport with drag-to-scroll functionality enabled. This is useful for Components such as sliders that


+ 1
- 1
modules/juce_gui_basics/drawables/juce_DrawablePath.cpp View File

@@ -143,7 +143,7 @@ void DrawablePath::setPath (const RelativePointPath& newRelativePath)
}
else
{
relativePath = nullptr;
relativePath.reset();
applyRelativePath (newRelativePath, nullptr);
}
}


+ 1
- 1
modules/juce_gui_basics/drawables/juce_DrawableShape.cpp View File

@@ -103,7 +103,7 @@ void DrawableShape::setFillInternal (RelativeFillType& fill, const RelativeFillT
if (fill != newFill)
{
fill = newFill;
pos = nullptr;
pos.reset();
if (fill.isDynamic())
{


+ 2
- 2
modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp View File

@@ -87,7 +87,7 @@ void DirectoryContentsList::stopSearching()
{
shouldStop = true;
thread.removeTimeSliceClient (this);
fileFindHandle = nullptr;
fileFindHandle.reset();
}
void DirectoryContentsList::clear()
@@ -210,7 +210,7 @@ bool DirectoryContentsList::checkNextFile (bool& hasChanged)
return true;
}
fileFindHandle = nullptr;
fileFindHandle.reset();
}
return false;


+ 2
- 2
modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp View File

@@ -121,8 +121,8 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
FileBrowserComponent::~FileBrowserComponent()
{
fileListComponent = nullptr;
fileList = nullptr;
fileListComponent.reset();
fileList.reset();
thread.stopThread (10000);
}


+ 1
- 1
modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp View File

@@ -88,7 +88,7 @@ void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)
void FilenameComponent::lookAndFeelChanged()
{
browseButton = nullptr;
browseButton.reset();
addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText));
browseButton->setConnectedEdges (Button::ConnectedOnLeft);


+ 1
- 1
modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp View File

@@ -61,7 +61,7 @@ public:
if (useProxyComponent)
proxy = new ProxyComponent (*component);
else
proxy = nullptr;
proxy.reset();
component->setVisible (! useProxyComponent);
}


+ 2
- 2
modules/juce_gui_basics/layout/juce_MultiDocumentPanel.cpp View File

@@ -282,7 +282,7 @@ bool MultiDocumentPanel::closeDocument (Component* component,
delete component;
if (tabComponent != nullptr && tabComponent->getNumTabs() <= numDocsBeforeTabsUsed)
tabComponent = nullptr;
tabComponent.reset();
components.removeFirstMatchingValue (component);
@@ -387,7 +387,7 @@ void MultiDocumentPanel::setLayoutMode (const LayoutMode newLayoutMode)
if (mode == FloatingWindows)
{
tabComponent = nullptr;
tabComponent.reset();
}
else
{


+ 1
- 1
modules/juce_gui_basics/layout/juce_MultiDocumentPanel.h View File

@@ -242,7 +242,7 @@ public:
Colour getBackgroundColour() const noexcept { return backgroundColour; }
/** If the panel is being used in tabbed mode, this returns the TabbedComponent that's involved. */
TabbedComponent* getCurrentTabbedComponent() const noexcept { return tabComponent; }
TabbedComponent* getCurrentTabbedComponent() const noexcept { return tabComponent.get(); }
//==============================================================================
/** A subclass must override this to say whether its currently ok for a document


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save