Browse Source

Projucer: Fixed some static analyzer warnings

v6.1.6
ed 4 years ago
parent
commit
89ca17cf34
2 changed files with 11 additions and 12 deletions
  1. +10
    -11
      extras/Projucer/Source/Application/jucer_AutoUpdater.cpp
  2. +1
    -1
      extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElement.cpp

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

@@ -240,10 +240,9 @@ void LatestVersionCheckerAndUpdater::askUserForLocationToDownload (const Version
{
chooser = std::make_unique<FileChooser> ("Please select the location into which you would like to install the new version",
File { getAppSettings().getStoredPath (Ids::jucePath, TargetOS::getThisOS()).get() });
auto flags = FileBrowserComponent::openMode
| FileBrowserComponent::canSelectDirectories;
chooser->launchAsync (flags, [this, asset] (const FileChooser& fc)
chooser->launchAsync (FileBrowserComponent::openMode | FileBrowserComponent::canSelectDirectories,
[weakThis = WeakReference<LatestVersionCheckerAndUpdater> { this }, asset] (const FileChooser& fc)
{
auto targetFolder = fc.getResult();
@@ -264,14 +263,13 @@ void LatestVersionCheckerAndUpdater::askUserForLocationToDownload (const Version
auto targetFolderPath = targetFolder.getFullPathName();
WeakReference<LatestVersionCheckerAndUpdater> parent { this };
auto callback = ModalCallbackFunction::create ([parent, asset, targetFolder] (int result)
const auto onResult = [weakThis, asset, targetFolder] (int result)
{
if (parent == nullptr || result == 0)
if (weakThis == nullptr || result == 0)
return;
parent->downloadAndInstall (asset, targetFolder);
});
weakThis->downloadAndInstall (asset, targetFolder);
};
if (willOverwriteJuceFolder)
{
@@ -291,7 +289,7 @@ void LatestVersionCheckerAndUpdater::askUserForLocationToDownload (const Version
{},
{},
nullptr,
callback);
ModalCallbackFunction::create (onResult));
return;
}
@@ -303,11 +301,12 @@ void LatestVersionCheckerAndUpdater::askUserForLocationToDownload (const Version
{},
{},
nullptr,
callback);
ModalCallbackFunction::create (onResult));
return;
}
downloadAndInstall (asset, targetFolder);
if (weakThis != nullptr)
weakThis->downloadAndInstall (asset, targetFolder);
});
}


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

@@ -670,7 +670,7 @@ void PaintElement::showPopupMenu()
m.addCommandItem (commandManager, JucerCommandIDs::toBack);
m.addSeparator();
if (owner->getSelectedElements().getNumSelected() > 1)
if (owner != nullptr && owner->getSelectedElements().getNumSelected() > 1)
{
m.addCommandItem (commandManager, JucerCommandIDs::alignTop);
m.addCommandItem (commandManager, JucerCommandIDs::alignRight);


Loading…
Cancel
Save