[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-windows
Subject: [patch] Re: KPixampCache crash
From: Jarosław_Staniek <js () iidea ! pl>
Date: 2007-08-23 13:13:18
Message-ID: 46CD87EE.1040002 () iidea ! pl
[Download RAW message or body]
The patch.
--
regards / pozdrawiam, Jaroslaw Staniek
Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org
["kpixmapcache.patch" (text/plain)]
Index: kdeui\icons/kpixmapcache.cpp
===================================================================
--- kdeui\icons/kpixmapcache.cpp (revision 703827)
+++ kdeui\icons/kpixmapcache.cpp (working copy)
@@ -52,7 +52,7 @@
//#define DISABLE_PIXMAPCACHE
-#ifdef HAVE_MMAP
+#if defined HAVE_MMAP && !defined Q_WS_WIN
#define USE_MMAP
#endif
@@ -386,7 +386,9 @@
void KPixmapCache::Private::invalidateMmapFiles()
{
-#ifdef HAVE_MMAP
+ if (!q->isValid())
+ return;
+#ifdef USE_MMAP
// Set cache id to 0, this will force a reload the next time the files \
are used if (mIndexMmapInfo.file) {
KPCMemoryDevice dev(mIndexMmapInfo.memory, &mIndexMmapInfo.size, \
mIndexMmapInfo.available); @@ -400,11 +402,12 @@
bool KPixmapCache::Private::mmapFile(const QString& filename, MmapInfo* \
info, int newsize) {
-#ifdef HAVE_MMAP
+#ifdef USE_MMAP
info->file = new QFile(filename);
if (!info->file->open(QIODevice::ReadWrite)) {
kDebug() << "Couldn't open" << filename;
delete info->file;
+ info->file = 0;
return false;
}
@@ -415,6 +418,7 @@
if (!info->file->resize(info->available)) {
kError() << "Couldn't resize" << filename << "to" << newsize;
delete info->file;
+ info->file = 0;
return false;
}
@@ -422,6 +426,7 @@
if (indexMem == MAP_FAILED) {
kError() << "mmap failed for" << filename;
delete info->file;
+ info->file = 0;
return false;
}
info->memory = reinterpret_cast<char*>(indexMem);
@@ -443,7 +448,7 @@
void KPixmapCache::Private::unmmapFile(MmapInfo* info)
{
-#ifdef HAVE_MMAP
+#ifdef USE_MMAP
if (info->file) {
munmap(info->memory, info->available);
delete info->file;
@@ -1017,7 +1022,7 @@
int KPixmapCache::size() const
{
ensureInited();
-#ifdef HAVE_MMAP
+#ifdef USE_MMAP
if (d->mDataMmapInfo.file) {
return d->mDataMmapInfo.size / 1024;
}
_______________________________________________
Kde-windows mailing list
Kde-windows@kde.org
https://mail.kde.org/mailman/listinfo/kde-windows
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic