[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kcm-grub2] src: Manage some ImageMagick crashes.
From:       Konstantinos Smanis <konstantinos.smanis () gmail ! com>
Date:       2013-06-20 11:45:11
Message-ID: E1UpdId-00027Z-Cx () scm ! kde ! org
[Download RAW message or body]

Git commit 5612e52fb0e3818cf2fe810d35b9d6c44a36e462 by Konstantinos Smanis.
Committed on 20/06/2013 at 11:37.
Pushed by ksmanis into branch 'master'.

Manage some ImageMagick crashes.

1. Do not crash when saving in a directory where we don't have write
   permissions.
2. Do not crash when using path names with non-ASCII characters.

BUG: 319947

M  +5    -2    src/convertDlg.cpp

http://commits.kde.org/kcm-grub2/5612e52fb0e3818cf2fe810d35b9d6c44a36e462

diff --git a/src/convertDlg.cpp b/src/convertDlg.cpp
index ca9e6da..d61cfe1 100644
--- a/src/convertDlg.cpp
+++ b/src/convertDlg.cpp
@@ -78,14 +78,17 @@ void ConvertDialog::slotButtonClicked(int button)
         } else if (ui->spinBox_width->value() == 0 || ui->spinBox_height->value() == \
                0) {
             KMessageBox::information(this, i18nc("@info", "Please fill in both \
<interface>Width</interface> and <interface>Height</interface> fields."));  return;
+        } else if (!QFileInfo(ui->kurlrequester_converted->url().directory()).isWritable()) \
{ +            KMessageBox::information(this, i18nc("@info", "You do not have write \
permissions in this directory, please select another destination.")); +            \
return;  }
         Magick::Geometry resolution(ui->spinBox_width->value(), \
ui->spinBox_height->value());  resolution.aspect(ui->checkBox_force->isChecked());
-        Magick::Image \
image(ui->kurlrequester_image->url().toLocalFile().toStdString()); +        \
Magick::Image image(std::string(ui->kurlrequester_image->url().toLocalFile().toUtf8()));
  image.zoom(resolution);
         image.depth(8);
         image.classType(Magick::DirectClass);
-        image.write(ui->kurlrequester_converted->url().toLocalFile().toStdString());
+        image.write(std::string(ui->kurlrequester_converted->url().toLocalFile().toUtf8()));
  if (ui->checkBox_wallpaper->isChecked()) {
             emit splashImageCreated(ui->kurlrequester_converted->url().toLocalFile());
  }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic