[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:45:51 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 8aa0b9c84f9eb3126819307ca5edb62d44565431
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jun 15 05:33:44 2004 +0000
Reviewed by me, code changes by Patrick Beard.
- fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
* WebCore.pbproj/project.pbxproj: Added KWQFoundationExtras.h.
* kwq/KWQFoundationExtras.h: Added.
(KWQRetain): Cover for CFRetain that is tolerant of nil.
(KWQRelease): Cover for CFRelease that is tolerant of nil.
(KWQRetainNSRelease): Combination of a CFRetain and an -[NSObject release] that is tolerant of nil.
Also includes a declaration of finalize so we can call [super finalize] without warnings on Panther.
* kwq/DOM.mm:
(ObjCNodeFilterCondition::ObjCNodeFilterCondition): Use CFRetain instead of retain.
(ObjCNodeFilterCondition::~ObjCNodeFilterCondition): Use CFRelease instead of release.
* kwq/KWQComboBox.mm:
(QComboBox::~QComboBox): Use KWQRelease instead of release.
(QComboBox::setFont): Use KWQRelease instead of release.
(QComboBox::labelFont): Use KWQRetain instead of retain.
* kwq/KWQCursor.mm:
(QCursor::QCursor): Use KWQRetain instead of retain.
(QCursor::~QCursor): Use KWQRelease instead of release.
(QCursor::operator=): More of the same.
* kwq/KWQFileButton.mm:
(KWQFileButton::KWQFileButton): Use KWQRetainNSRelease to retain a newly-allocated object.
(KWQFileButton::~KWQFileButton): Use CFRelease instead of release.
* kwq/KWQFont.mm:
(QFont::QFont): Use KWQRetain instead of retain.
(QFont::operator=): More of the same.
(QFont::setFamily): Use KWQRelease instead of release.
(QFont::setFirstFamily): Use KWQRelease instead of release.
(QFont::setPixelSize): Use KWQRelease instead of release.
(QFont::setWeight): Use KWQRelease instead of release.
(QFont::setItalic): Use KWQRelease instead of release.
(QFont::getNSFont): Use KWQRetain instead of retain.
* kwq/KWQFontMetrics.mm:
(QFontMetricsPrivate::~QFontMetricsPrivate): Use KWQRelease instead of release.
(QFontMetricsPrivate::getRenderer): Use KWQRetain instead of retain.
(QFontMetricsPrivate::setFont): Use KWQRelease instead of release.
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::~KWQKHTMLPart): Use KWQRelease instead of release.
(KWQKHTMLPart::clearRecordedFormValues): Use KWQRelease instead of release.
(KWQKHTMLPart::recordFormValue): Use KWQRetainNSRelease and use KWQRetain instead of retain.
(KWQKHTMLPart::windowScriptObject): Use KWQRetainNSRelease.
* kwq/KWQKJobClasses.mm:
(KIO::TransferJobPrivate::TransferJobPrivate): Use KWQRetainNSRelease.
(KIO::TransferJobPrivate::~TransferJobPrivate): Use KWQRelease instead of release.
(KIO::TransferJob::setLoader): More of the same.
* kwq/KWQLoader.mm:
(KWQRetainResponse): Use KWQRetain instead of retain.
(KWQReleaseResponse): Use KWQRelease instead of release.
* kwq/KWQPainter.mm:
(QPainterPrivate::~QPainterPrivate): Use KWQRelease instead of release.
(QPainter::_updateRenderer): More of the same.
(QPainter::initFocusRing): Use KWQRetainNSRelease.
(QPainter::clearFocusRing): Use KWQRelease instead of release.
* kwq/KWQPixmap.mm:
(QPixmap::QPixmap): Use KWQRetain instead of retain.
(QPixmap::~QPixmap): Use KWQRelease instead of release.
(QPixmap::receivedData): Use KWQRetain instead of retain.
(QPixmap::resize): Use KWQRetainNSRelease and use KWQRelease instead of release.
(QPixmap::operator=): More of the same.
* kwq/KWQRegion.mm:
(QRegion::QRegion): Use KWQRetain instead of retain.
(QRegion::~QRegion): Use KWQRelease instead of release.
(QRegion::operator=): More of the same.
* kwq/KWQTimer.mm:
(QTimer::start): Use KWQRetain instead of retain.
(QTimer::stop): Use KWQRelease instead of release.
(QTimer::fire): Use KWQRelease instead of release.
* kwq/KWQWidget.mm:
(QWidget::QWidget): Use KWQRetain instead of retain.
(QWidget::~QWidget): Use KWQRelease instead of release.
(QWidget::setView): More of the same.
* kwq/WebCoreSettings.mm: (-[WebCoreSettings finalize]):
Delete the storage here, as well as in dealloc.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6838 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 7d90bba..ab3a424 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,81 @@
+2004-06-14 Darin Adler <darin at apple.com>
+
+ Reviewed by me, code changes by Patrick Beard.
+
+ - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
+
+ * WebCore.pbproj/project.pbxproj: Added KWQFoundationExtras.h.
+ * kwq/KWQFoundationExtras.h: Added.
+ (KWQRetain): Cover for CFRetain that is tolerant of nil.
+ (KWQRelease): Cover for CFRelease that is tolerant of nil.
+ (KWQRetainNSRelease): Combination of a CFRetain and an -[NSObject release] that is tolerant of nil.
+ Also includes a declaration of finalize so we can call [super finalize] without warnings on Panther.
+
+ * kwq/DOM.mm:
+ (ObjCNodeFilterCondition::ObjCNodeFilterCondition): Use CFRetain instead of retain.
+ (ObjCNodeFilterCondition::~ObjCNodeFilterCondition): Use CFRelease instead of release.
+ * kwq/KWQComboBox.mm:
+ (QComboBox::~QComboBox): Use KWQRelease instead of release.
+ (QComboBox::setFont): Use KWQRelease instead of release.
+ (QComboBox::labelFont): Use KWQRetain instead of retain.
+ * kwq/KWQCursor.mm:
+ (QCursor::QCursor): Use KWQRetain instead of retain.
+ (QCursor::~QCursor): Use KWQRelease instead of release.
+ (QCursor::operator=): More of the same.
+ * kwq/KWQFileButton.mm:
+ (KWQFileButton::KWQFileButton): Use KWQRetainNSRelease to retain a newly-allocated object.
+ (KWQFileButton::~KWQFileButton): Use CFRelease instead of release.
+ * kwq/KWQFont.mm:
+ (QFont::QFont): Use KWQRetain instead of retain.
+ (QFont::operator=): More of the same.
+ (QFont::setFamily): Use KWQRelease instead of release.
+ (QFont::setFirstFamily): Use KWQRelease instead of release.
+ (QFont::setPixelSize): Use KWQRelease instead of release.
+ (QFont::setWeight): Use KWQRelease instead of release.
+ (QFont::setItalic): Use KWQRelease instead of release.
+ (QFont::getNSFont): Use KWQRetain instead of retain.
+ * kwq/KWQFontMetrics.mm:
+ (QFontMetricsPrivate::~QFontMetricsPrivate): Use KWQRelease instead of release.
+ (QFontMetricsPrivate::getRenderer): Use KWQRetain instead of retain.
+ (QFontMetricsPrivate::setFont): Use KWQRelease instead of release.
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::~KWQKHTMLPart): Use KWQRelease instead of release.
+ (KWQKHTMLPart::clearRecordedFormValues): Use KWQRelease instead of release.
+ (KWQKHTMLPart::recordFormValue): Use KWQRetainNSRelease and use KWQRetain instead of retain.
+ (KWQKHTMLPart::windowScriptObject): Use KWQRetainNSRelease.
+ * kwq/KWQKJobClasses.mm:
+ (KIO::TransferJobPrivate::TransferJobPrivate): Use KWQRetainNSRelease.
+ (KIO::TransferJobPrivate::~TransferJobPrivate): Use KWQRelease instead of release.
+ (KIO::TransferJob::setLoader): More of the same.
+ * kwq/KWQLoader.mm:
+ (KWQRetainResponse): Use KWQRetain instead of retain.
+ (KWQReleaseResponse): Use KWQRelease instead of release.
+ * kwq/KWQPainter.mm:
+ (QPainterPrivate::~QPainterPrivate): Use KWQRelease instead of release.
+ (QPainter::_updateRenderer): More of the same.
+ (QPainter::initFocusRing): Use KWQRetainNSRelease.
+ (QPainter::clearFocusRing): Use KWQRelease instead of release.
+ * kwq/KWQPixmap.mm:
+ (QPixmap::QPixmap): Use KWQRetain instead of retain.
+ (QPixmap::~QPixmap): Use KWQRelease instead of release.
+ (QPixmap::receivedData): Use KWQRetain instead of retain.
+ (QPixmap::resize): Use KWQRetainNSRelease and use KWQRelease instead of release.
+ (QPixmap::operator=): More of the same.
+ * kwq/KWQRegion.mm:
+ (QRegion::QRegion): Use KWQRetain instead of retain.
+ (QRegion::~QRegion): Use KWQRelease instead of release.
+ (QRegion::operator=): More of the same.
+ * kwq/KWQTimer.mm:
+ (QTimer::start): Use KWQRetain instead of retain.
+ (QTimer::stop): Use KWQRelease instead of release.
+ (QTimer::fire): Use KWQRelease instead of release.
+ * kwq/KWQWidget.mm:
+ (QWidget::QWidget): Use KWQRetain instead of retain.
+ (QWidget::~QWidget): Use KWQRelease instead of release.
+ (QWidget::setView): More of the same.
+ * kwq/WebCoreSettings.mm: (-[WebCoreSettings finalize]):
+ Delete the storage here, as well as in dealloc.
+
2004-06-14 Maciej Stachowiak <mjs at apple.com>
Reviewed by Trey.
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 622157a..5be1989 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -529,6 +529,7 @@
2D90660D0665D937006B6F1A,
BE02F484066E1C550013A9F6,
BE02D4E8066F908A0076809F,
+ 93D1FEF7067EBF89009CE68A,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2112,6 +2113,20 @@
settings = {
};
};
+ 93D1FEF6067EBF89009CE68A = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = KWQFoundationExtras.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 93D1FEF7067EBF89009CE68A = {
+ fileRef = 93D1FEF6067EBF89009CE68A;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
93ECDB7E03ABE65B008635CE = {
fileEncoding = 4;
isa = PBXFileReference;
@@ -3342,6 +3357,7 @@
93CCF7D5033BD43C008635CE,
9394E0A903AA60FB008635CE,
9394E0AA03AA60FB008635CE,
+ 93D1FEF6067EBF89009CE68A,
F58784EE02DE375901EA4122,
F58784EF02DE375901EA4122,
F58784FA02DE375901EA4122,
diff --git a/WebCore/kwq/DOM.mm b/WebCore/kwq/DOM.mm
index f086cb1..a282fdf 100644
--- a/WebCore/kwq/DOM.mm
+++ b/WebCore/kwq/DOM.mm
@@ -2142,7 +2142,11 @@ public:
ObjCNodeFilterCondition(id <DOMNodeFilter>);
virtual ~ObjCNodeFilterCondition();
virtual short acceptNode(const Node &) const;
+
private:
+ ObjCNodeFilterCondition(const ObjCNodeFilterCondition &);
+ ObjCNodeFilterCondition &operator=(const ObjCNodeFilterCondition &);
+
id <DOMNodeFilter> m_filter;
};
@@ -2150,12 +2154,12 @@ ObjCNodeFilterCondition::ObjCNodeFilterCondition(id <DOMNodeFilter> filter)
: m_filter(filter)
{
ASSERT(m_filter);
- [m_filter retain];
+ CFRetain(m_filter);
}
ObjCNodeFilterCondition::~ObjCNodeFilterCondition()
{
- [m_filter release];
+ CFRelease(m_filter);
}
short ObjCNodeFilterCondition::acceptNode(const Node &n) const
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index f7e81f6..68dd6fd 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -30,6 +30,7 @@
#import "KWQExceptions.h"
#import "KWQKHTMLPart.h"
#import "KWQNSViewExtras.h"
+#import "KWQFoundationExtras.h"
#import "KWQView.h"
#import "WebCoreBridge.h"
#import "WebCoreTextRenderer.h"
@@ -105,7 +106,7 @@ QComboBox::~QComboBox()
KWQPopUpButton *button = (KWQPopUpButton *)getView();
[button setTarget:nil];
- [_labelFont release];
+ KWQRelease(_labelFont);
KWQ_UNBLOCK_EXCEPTIONS;
}
@@ -283,7 +284,7 @@ void QComboBox::setFont(const QFont &f)
if (size != [[button cell] controlSize]) {
[[button cell] setControlSize:size];
[button setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
- [_labelFont release];
+ KWQRelease(_labelFont);
_labelFont = nil;
_widthGood = false;
}
@@ -295,7 +296,7 @@ NSFont *QComboBox::labelFont() const
{
if (_labelFont == nil) {
NSControl * const button = static_cast<NSControl *>(getView());
- _labelFont = [[NSFont boldSystemFontOfSize:[[button font] pointSize]] retain];
+ _labelFont = KWQRetain([NSFont boldSystemFontOfSize:[[button font] pointSize]]);
}
return _labelFont;
}
diff --git a/WebCore/kwq/KWQCursor.mm b/WebCore/kwq/KWQCursor.mm
index 46cf35d..4246567 100644
--- a/WebCore/kwq/KWQCursor.mm
+++ b/WebCore/kwq/KWQCursor.mm
@@ -25,6 +25,7 @@
#import "KWQCursor.h"
#import "KWQLogging.h"
+#import "KWQFoundationExtras.h"
// The NSCursor cocoa calls here can't fail, so no need to block Cocoa exceptions
@@ -34,7 +35,7 @@ QCursor::QCursor()
}
QCursor::QCursor(NSCursor *cur)
- : cursor([cur retain])
+ : cursor(KWQRetain(cur))
{
}
@@ -46,19 +47,19 @@ QCursor::QCursor(const QPixmap &pixmap)
}
QCursor::QCursor(const QCursor &other)
- : cursor([other.cursor retain])
+ : cursor(KWQRetain(other.cursor))
{
}
QCursor::~QCursor()
{
- [cursor release];
+ KWQRelease(cursor);
}
QCursor &QCursor::operator=(const QCursor &other)
{
- [other.cursor retain];
- [cursor release];
+ KWQRetain(other.cursor);
+ KWQRelease(cursor);
cursor = other.cursor;
return *this;
}
diff --git a/WebCore/kwq/KWQFileButton.mm b/WebCore/kwq/KWQFileButton.mm
index 7fbe7a2..79842ea 100644
--- a/WebCore/kwq/KWQFileButton.mm
+++ b/WebCore/kwq/KWQFileButton.mm
@@ -29,6 +29,7 @@
#import "KWQExceptions.h"
#import "KWQKHTMLPart.h"
#import "KWQNSViewExtras.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreBridge.h"
@interface KWQFileButtonAdapter : NSObject <WebCoreFileButtonDelegate>
@@ -51,7 +52,7 @@ KWQFileButton::KWQFileButton(KHTMLPart *part)
{
KWQ_BLOCK_EXCEPTIONS;
- _adapter = [[KWQFileButtonAdapter alloc] initWithKWQFileButton:this];
+ _adapter = KWQRetainNSRelease([[KWQFileButtonAdapter alloc] initWithKWQFileButton:this]);
setView([KWQ(part)->bridge() fileButtonWithDelegate:_adapter]);
KWQ_UNBLOCK_EXCEPTIONS;
@@ -61,7 +62,7 @@ KWQFileButton::~KWQFileButton()
{
_adapter->button = 0;
KWQ_BLOCK_EXCEPTIONS;
- [_adapter release];
+ CFRelease(_adapter);
KWQ_UNBLOCK_EXCEPTIONS;
}
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQFont.mm
index 17e5cf8..523baf3 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQFont.mm
@@ -27,6 +27,7 @@
#import "KWQExceptions.h"
#import "KWQString.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreTextRendererFactory.h"
QFont::QFont()
@@ -47,7 +48,7 @@ QFont::QFont(const QFont &other)
, _trait(other._trait)
, _size(other._size)
, _isPrinterFont(other._isPrinterFont)
- , _NSFont([other._NSFont retain])
+ , _NSFont(KWQRetain(other._NSFont))
{
}
@@ -57,8 +58,8 @@ QFont &QFont::operator=(const QFont &other)
_trait = other._trait;
_size = other._size;
_isPrinterFont = other._isPrinterFont;
- [other._NSFont retain];
- [_NSFont release];
+ KWQRetain(other._NSFont);
+ KWQRelease(_NSFont);
_NSFont = other._NSFont;
return *this;
}
@@ -71,21 +72,21 @@ QString QFont::family() const
void QFont::setFamily(const QString &qfamilyName)
{
_family.setFamily(qfamilyName);
- [_NSFont release];
+ KWQRelease(_NSFont);
_NSFont = 0;
}
void QFont::setFirstFamily(const KWQFontFamily& family)
{
_family = family;
- [_NSFont release];
+ KWQRelease(_NSFont);
_NSFont = 0;
}
void QFont::setPixelSize(float s)
{
if (_size != s) {
- [_NSFont release];
+ KWQRelease(_NSFont);
_NSFont = 0;
}
_size = s;
@@ -95,13 +96,13 @@ void QFont::setWeight(int weight)
{
if (weight == Bold) {
if (!(_trait & NSBoldFontMask)){
- [_NSFont release];
+ KWQRelease(_NSFont);
_NSFont = 0;
}
_trait |= NSBoldFontMask;
} else if (weight == Normal) {
if ((_trait & NSBoldFontMask)){
- [_NSFont release];
+ KWQRelease(_NSFont);
_NSFont = 0;
}
_trait &= ~NSBoldFontMask;
@@ -122,13 +123,13 @@ void QFont::setItalic(bool flag)
{
if (flag) {
if (!(_trait & NSItalicFontMask)){
- [_NSFont release];
+ KWQRelease(_NSFont);
_NSFont = 0;
}
_trait |= NSItalicFontMask;
} else {
if ((_trait & NSItalicFontMask)){
- [_NSFont release];
+ KWQRelease(_NSFont);
_NSFont = 0;
}
_trait &= ~NSItalicFontMask;
@@ -167,10 +168,10 @@ NSFont *QFont::getNSFont() const
if (!_NSFont) {
CREATE_FAMILY_ARRAY(*this, families);
KWQ_BLOCK_EXCEPTIONS;
- _NSFont = [[[WebCoreTextRendererFactory sharedFactory]
+ _NSFont = KWQRetain([[WebCoreTextRendererFactory sharedFactory]
fontWithFamilies:families
traits:getNSTraits()
- size:getNSSize()] retain];
+ size:getNSSize()]);
KWQ_UNBLOCK_EXCEPTIONS;
}
return _NSFont;
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index f2716af..50d0dea 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -29,6 +29,7 @@
#import "KWQFont.h"
#import "KWQLogging.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreTextRenderer.h"
#import "WebCoreTextRendererFactory.h"
@@ -45,14 +46,14 @@ struct QFontMetricsPrivate
}
~QFontMetricsPrivate()
{
- [_renderer release];
+ KWQRelease(_renderer);
}
id <WebCoreTextRenderer> getRenderer()
{
if (!_renderer) {
- _renderer = [[[WebCoreTextRendererFactory sharedFactory]
+ _renderer = KWQRetain([[WebCoreTextRendererFactory sharedFactory]
rendererWithFont:_font.getNSFont()
- usingPrinterFont:_font.isPrinterFont()] retain];
+ usingPrinterFont:_font.isPrinterFont()]);
}
return _renderer;
}
@@ -64,7 +65,7 @@ struct QFontMetricsPrivate
return;
}
_font = font;
- [_renderer release];
+ KWQRelease(_renderer);
_renderer = nil;
}
diff --git a/WebCore/kwq/KWQPoint.mm b/WebCore/kwq/KWQFoundationExtras.h
similarity index 50%
copy from WebCore/kwq/KWQPoint.mm
copy to WebCore/kwq/KWQFoundationExtras.h
index 8b84b5d..02e5470 100644
--- a/WebCore/kwq/KWQPoint.mm
+++ b/WebCore/kwq/KWQFoundationExtras.h
@@ -20,41 +20,52 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "KWQPointArray.h"
+#import <Foundation/Foundation.h>
-QPoint::QPoint() : xCoord(0), yCoord(0)
-{
-}
+// nil-checked CFRetain/CFRelease covers for Objective-C ids
-QPoint::QPoint(int xIn, int yIn) : xCoord(xIn), yCoord(yIn)
-{
-}
+// Use CFRetain, CFRelease, KWQRetain, or KWQRelease instead of
+// -[NSObject retain] and -[NSObject release] if you want to store
+// a pointer to an Objective-C object into memory that won't
+// be scanned for GC, like a C++ object.
-QPoint::QPoint(const NSPoint &p) : xCoord((int)p.x), yCoord((int)p.y)
+static inline id KWQRetain(id obj)
{
+ if (obj) CFRetain(obj);
+ return obj;
}
-QPoint::operator NSPoint() const
+static inline void KWQRelease(id obj)
{
- return NSMakePoint(xCoord, yCoord);
+ if (obj) CFRelease(obj);
}
-QPoint operator+(const QPoint &a, const QPoint &b)
-{
- return QPoint(a.xCoord + b.xCoord, a.yCoord + b.yCoord);
-}
+// As if CF and Foundation had logically separate reference counts,
+// this function first increments the CF retain count, and then
+// decrements the NS retain count. This is needed to handle cases where
+// -retain/-release aren't equivalent to CFRetain/KWQRelease, such as
+// when GC is used.
-QPoint operator-(const QPoint &a, const QPoint &b)
-{
- return QPoint(a.xCoord - b.xCoord, a.yCoord - b.yCoord);
-}
+// Use KWQRetainNSRelease after allocating and initializing a NSObject
+// if you want to store a pointer to that object into memory that won't
+// be scanned for GC, like a C++ object.
-#ifdef _KWQ_IOSTREAM_
-std::ostream &operator<<(std::ostream &o, const QPoint &p)
+static inline id KWQRetainNSRelease(id obj)
{
- return o << "QPoint: [x: " << p.x() << "; h: " << p.y() << "]";
+ return [KWQRetain(obj) release];
}
+
+// Definitions for GC-specific methods for Panther.
+// The finalize method simply won't be called.
+// The drain method is implemented (as a simple call to release).
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
+
+ at interface NSObject (KWQFoundationExtras)
+- (void)finalize;
+ at end
+
#endif
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 93a23f1..a15a908 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -37,6 +37,7 @@
#import "KWQPrinter.h"
#import "KWQScrollBar.h"
#import "KWQWindowWidget.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreBridge.h"
#import "WebCoreViewFactory.h"
#import "csshelper.h"
@@ -211,10 +212,10 @@ KWQKHTMLPart::~KWQKHTMLPart()
// these are all basic Foundation classes and our own classes - we
// know they will not raise in dealloc, so no need to block
// exceptions.
- [_formValuesAboutToBeSubmitted release];
- [_formAboutToBeSubmitted release];
+ KWQRelease(_formValuesAboutToBeSubmitted);
+ KWQRelease(_formAboutToBeSubmitted);
- [_windowScriptObject release];
+ KWQRelease(_windowScriptObject);
delete _windowWidget;
}
@@ -601,9 +602,9 @@ void KWQKHTMLPart::clearRecordedFormValues()
// It's safe to assume that our own classes and Foundation data
// structures won't raise exceptions in dealloc
- [_formValuesAboutToBeSubmitted release];
+ KWQRelease(_formValuesAboutToBeSubmitted);
_formValuesAboutToBeSubmitted = nil;
- [_formAboutToBeSubmitted release];
+ KWQRelease(_formAboutToBeSubmitted);
_formAboutToBeSubmitted = nil;
}
@@ -613,9 +614,9 @@ void KWQKHTMLPart::recordFormValue(const QString &name, const QString &value, HT
// data structures won't raise exceptions
if (!_formValuesAboutToBeSubmitted) {
- _formValuesAboutToBeSubmitted = [[NSMutableDictionary alloc] init];
+ _formValuesAboutToBeSubmitted = KWQRetainNSRelease([[NSMutableDictionary alloc] init]);
ASSERT(!_formAboutToBeSubmitted);
- _formAboutToBeSubmitted = [[DOMElement _elementWithImpl:element] retain];
+ _formAboutToBeSubmitted = KWQRetain([DOMElement _elementWithImpl:element]);
} else {
ASSERT([_formAboutToBeSubmitted _elementImpl] == element);
}
@@ -1169,7 +1170,7 @@ WebScriptObject *KWQKHTMLPart::windowScriptObject()
{
if (!_windowScriptObject) {
KJS::ObjectImp *win = static_cast<KJS::ObjectImp *>(KJS::Window::retrieveWindow(this));
- _windowScriptObject = [[WebScriptObject alloc] _initWithObjectImp:win root:bindingRootObject()];
+ _windowScriptObject = KWQRetainNSRelease([[WebScriptObject alloc] _initWithObjectImp:win root:bindingRootObject()]);
}
return _windowScriptObject;
diff --git a/WebCore/kwq/KWQKJobClasses.mm b/WebCore/kwq/KWQKJobClasses.mm
index 46f9fe2..9349c80 100644
--- a/WebCore/kwq/KWQKJobClasses.mm
+++ b/WebCore/kwq/KWQKJobClasses.mm
@@ -30,6 +30,7 @@
#import "KWQLoader.h"
#import "KWQResourceLoader.h"
#import "KWQString.h"
+#import "KWQFoundationExtras.h"
namespace KIO {
@@ -43,7 +44,7 @@ class TransferJobPrivate
public:
TransferJobPrivate(const KURL& kurl)
: status(0)
- , metaData([[NSMutableDictionary alloc] initWithCapacity:17])
+ , metaData(KWQRetainNSRelease([[NSMutableDictionary alloc] initWithCapacity:17]))
, URL(kurl)
, loader(nil)
, method("GET")
@@ -54,7 +55,7 @@ public:
TransferJobPrivate(const KURL& kurl, const QByteArray &_postData)
: status(0)
- , metaData([[NSMutableDictionary alloc] initWithCapacity:17])
+ , metaData(KWQRetainNSRelease([[NSMutableDictionary alloc] initWithCapacity:17]))
, URL(kurl)
, loader(nil)
, method("POST")
@@ -67,8 +68,8 @@ public:
~TransferJobPrivate()
{
KWQReleaseResponse(response);
- [metaData release];
- [loader release];
+ KWQRelease(metaData);
+ KWQRelease(loader);
}
int status;
@@ -173,8 +174,8 @@ void TransferJob::kill()
void TransferJob::setLoader(KWQResourceLoader *loader)
{
- [loader retain];
- [d->loader release];
+ KWQRetain(loader);
+ KWQRelease(d->loader);
d->loader = loader;
}
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index 7f68816..8986981 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -29,6 +29,7 @@
#import "KWQKJobClasses.h"
#import "KWQLogging.h"
#import "KWQResourceLoader.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreBridge.h"
#import "khtml_part.h"
#import "loader.h"
@@ -260,14 +261,14 @@ void KWQCheckCacheObjectStatus(DocLoader *loader, CachedObject *cachedObject)
void KWQRetainResponse(void *response)
{
// There's no way a retain can raise
- [(id)response retain];
+ KWQRetain((id)response);
}
void KWQReleaseResponse(void *response)
{
- // A release could raise if it deallocs, though...
+ // A release could raise if it deallocs.
KWQ_BLOCK_EXCEPTIONS;
- [(id)response release];
+ KWQRelease((id)response);
KWQ_UNBLOCK_EXCEPTIONS;
}
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index af70cdb..12c2210 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -35,6 +35,7 @@
#import "KWQPrinter.h"
#import "KWQPtrStack.h"
#import "KWQWidget.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreGraphicsBridge.h"
#import "WebCoreImageRenderer.h"
#import "WebCoreImageRendererFactory.h"
@@ -57,7 +58,7 @@ struct QPState {
struct QPainterPrivate {
QPainterPrivate() : textRenderer(0), focusRingPath(0), focusRingWidth(0), focusRingOffset(0),
hasFocusRingColor(false) { }
- ~QPainterPrivate() { [textRenderer release]; [focusRingPath release]; }
+ ~QPainterPrivate() { KWQRelease(textRenderer); KWQRelease(focusRingPath); }
QPState state;
QPtrStack<QPState> stack;
id <WebCoreTextRenderer> textRenderer;
@@ -551,10 +552,10 @@ void QPainter::_updateRenderer()
data->textRendererFont = data->state.font;
id <WebCoreTextRenderer> oldRenderer = data->textRenderer;
KWQ_BLOCK_EXCEPTIONS;
- data->textRenderer = [[[WebCoreTextRendererFactory sharedFactory]
+ data->textRenderer = KWQRetain([[WebCoreTextRendererFactory sharedFactory]
rendererWithFont:data->textRendererFont.getNSFont()
- usingPrinterFont:data->textRendererFont.isPrinterFont()] retain];
- [oldRenderer release];
+ usingPrinterFont:data->textRendererFont.isPrinterFont()]);
+ KWQRelease(oldRenderer);
KWQ_UNBLOCK_EXCEPTIONS;
}
}
@@ -787,7 +788,7 @@ void QPainter::initFocusRing(int width, int offset)
data->focusRingWidth = width;
data->hasFocusRingColor = false;
data->focusRingOffset = offset;
- data->focusRingPath = [[NSBezierPath alloc] init];
+ data->focusRingPath = KWQRetainNSRelease([[NSBezierPath alloc] init]);
[data->focusRingPath setWindingRule:NSNonZeroWindingRule];
}
@@ -841,7 +842,7 @@ void QPainter::drawFocusRing()
void QPainter::clearFocusRing()
{
if (data->focusRingPath) {
- [data->focusRingPath release];
+ KWQRelease(data->focusRingPath);
data->focusRingPath = nil;
}
}
diff --git a/WebCore/kwq/KWQPixmap.mm b/WebCore/kwq/KWQPixmap.mm
index 9d59b98..189afec 100644
--- a/WebCore/kwq/KWQPixmap.mm
+++ b/WebCore/kwq/KWQPixmap.mm
@@ -24,6 +24,7 @@
*/
#import "KWQPixmap.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreImageRenderer.h"
#import "WebCoreImageRendererFactory.h"
@@ -48,7 +49,7 @@ QPixmap::QPixmap()
QPixmap::QPixmap(WebCoreImageRendererPtr r)
{
- imageRenderer = [r retain];
+ imageRenderer = KWQRetain(r);
MIMEType = 0;
needCopyOnWrite = false;
}
@@ -63,14 +64,14 @@ QPixmap::QPixmap(void *MIME)
QPixmap::QPixmap(const QSize &sz)
{
- imageRenderer = [[[WebCoreImageRendererFactory sharedFactory] imageRendererWithSize:NSMakeSize(sz.width(), sz.height())] retain];
+ imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithSize:NSMakeSize(sz.width(), sz.height())]);
MIMEType = 0;
needCopyOnWrite = false;
}
QPixmap::QPixmap(const QByteArray &bytes)
{
- imageRenderer = [[[WebCoreImageRendererFactory sharedFactory] imageRendererWithBytes:bytes.data() length:bytes.size()] retain];
+ imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithBytes:bytes.data() length:bytes.size()]);
MIMEType = 0;
needCopyOnWrite = false;
}
@@ -78,35 +79,35 @@ QPixmap::QPixmap(const QByteArray &bytes)
QPixmap::QPixmap(const QByteArray &bytes, void *MIME)
{
MIMEType = (NSString *)[((NSString *)MIME) copy];
- imageRenderer = [[[WebCoreImageRendererFactory sharedFactory] imageRendererWithBytes:bytes.data() length:bytes.size() MIMEType:(NSString *)MIMEType] retain];
+ imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithBytes:bytes.data() length:bytes.size() MIMEType:(NSString *)MIMEType]);
needCopyOnWrite = false;
}
QPixmap::QPixmap(int w, int h)
{
- imageRenderer = [[[WebCoreImageRendererFactory sharedFactory] imageRendererWithSize:NSMakeSize(w, h)] retain];
+ imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithSize:NSMakeSize(w, h)]);
MIMEType = 0;
needCopyOnWrite = false;
}
QPixmap::QPixmap(const QPixmap ©From) : QPaintDevice(copyFrom)
{
- imageRenderer = [copyFrom.imageRenderer retain];
- MIMEType = [copyFrom.MIMEType copy];
+ imageRenderer = KWQRetain(copyFrom.imageRenderer);
+ MIMEType = KWQRetainNSRelease([copyFrom.MIMEType copy]);
copyFrom.needCopyOnWrite = true;
needCopyOnWrite = true;
}
QPixmap::~QPixmap()
{
- [MIMEType release];
- [imageRenderer release];
+ KWQRelease(MIMEType);
+ KWQRelease(imageRenderer);
}
bool QPixmap::receivedData(const QByteArray &bytes, bool isComplete)
{
if (imageRenderer == nil) {
- imageRenderer = [[[WebCoreImageRendererFactory sharedFactory] imageRendererWithMIMEType:MIMEType] retain];
+ imageRenderer = KWQRetain([[WebCoreImageRendererFactory sharedFactory] imageRendererWithMIMEType:MIMEType]);
}
return [imageRenderer incrementalLoadWithBytes:bytes.data() length:bytes.size() complete:isComplete];
}
@@ -163,8 +164,8 @@ void QPixmap::resize(const QSize &sz)
void QPixmap::resize(int w, int h)
{
if (needCopyOnWrite) {
- id <WebCoreImageRenderer> newImageRenderer = [imageRenderer copyWithZone:NULL];
- [imageRenderer release];
+ id <WebCoreImageRenderer> newImageRenderer = KWQRetainNSRelease([imageRenderer copyWithZone:NULL]);
+ KWQRelease(imageRenderer);
imageRenderer = newImageRenderer;
needCopyOnWrite = false;
}
@@ -185,10 +186,10 @@ QPixmap QPixmap::xForm(const QWMatrix &xmatrix) const
QPixmap &QPixmap::operator=(const QPixmap &assignFrom)
{
id <WebCoreImageRenderer> oldImageRenderer = imageRenderer;
- imageRenderer = [assignFrom.imageRenderer retainOrCopyIfNeeded];
- [oldImageRenderer release];
- NSString *newMIMEType = [assignFrom.MIMEType copy];
- [MIMEType release];
+ imageRenderer = KWQRetainNSRelease([assignFrom.imageRenderer retainOrCopyIfNeeded]);
+ KWQRelease(oldImageRenderer);
+ NSString *newMIMEType = KWQRetainNSRelease([assignFrom.MIMEType copy]);
+ KWQRelease(MIMEType);
MIMEType = newMIMEType;
assignFrom.needCopyOnWrite = true;
needCopyOnWrite = true;
diff --git a/WebCore/kwq/KWQRegion.mm b/WebCore/kwq/KWQRegion.mm
index a6da16b..3b9080f 100644
--- a/WebCore/kwq/KWQRegion.mm
+++ b/WebCore/kwq/KWQRegion.mm
@@ -24,28 +24,29 @@
*/
#import "KWQRegion.h"
+#import "KWQFoundationExtras.h"
// None of the NSBezierPath calls here can possibly throw an NSException.
// Some path calls do this when the path is empty, but we always make
// those when the path is guaranteed non-empty.
QRegion::QRegion(const QRect &rect)
- : path([[NSBezierPath bezierPathWithRect:rect] retain])
+ : path(KWQRetain([NSBezierPath bezierPathWithRect:rect]))
{
}
QRegion::QRegion(int x, int y, int w, int h, RegionType t)
{
if (t == Rectangle) {
- path = [[NSBezierPath bezierPathWithRect:NSMakeRect(x, y, w, h)] retain];
+ path = KWQRetain([NSBezierPath bezierPathWithRect:NSMakeRect(x, y, w, h)]);
} else { // Ellipse
- path = [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(x, y, w, h)] retain];
+ path = KWQRetain([NSBezierPath bezierPathWithOvalInRect:NSMakeRect(x, y, w, h)]);
}
}
QRegion::QRegion(const QPointArray &arr)
{
- path = [[NSBezierPath alloc] init];
+ path = KWQRetainNSRelease([[NSBezierPath alloc] init]);
[path moveToPoint:arr[0]];
// the moveToPoint: guarantees the path is not empty, which means lineToPoint:
// can't throw.
@@ -56,11 +57,11 @@ QRegion::QRegion(const QPointArray &arr)
QRegion::~QRegion()
{
- [path release];
+ KWQRelease(path);
}
QRegion::QRegion(const QRegion &other)
- : path([other.path copy])
+ : path(KWQRetainNSRelease([other.path copy]))
{
}
@@ -69,8 +70,8 @@ QRegion &QRegion::operator=(const QRegion &other)
if (path == other.path) {
return *this;
}
- [path release];
- path = [other.path copy];
+ KWQRelease(path);
+ path = KWQRetainNSRelease([other.path copy]);
return *this;
}
diff --git a/WebCore/kwq/KWQTimer.mm b/WebCore/kwq/KWQTimer.mm
index 665fe08..1c828f3 100644
--- a/WebCore/kwq/KWQTimer.mm
+++ b/WebCore/kwq/KWQTimer.mm
@@ -26,6 +26,7 @@
#import "KWQTimer.h"
#import "KWQAssertions.h"
+#import "KWQFoundationExtras.h"
// We know the Cocoa calls in this file are safe because they are all
// to the simple ObjC class defined here, or simple NSTimer calls that
@@ -98,11 +99,11 @@ bool QTimer::isActive() const
void QTimer::start(int msec, bool singleShot)
{
stop();
- m_timer = [[NSTimer scheduledTimerWithTimeInterval:(msec / 1000.0)
+ m_timer = KWQRetain([NSTimer scheduledTimerWithTimeInterval:(msec / 1000.0)
target:[KWQTimerTarget targetWithQTimer:this]
selector:@selector(timerFired:)
userInfo:nil
- repeats:!singleShot] retain];
+ repeats:!singleShot]);
if (m_monitorFunction) {
m_monitorFunction(m_monitorFunctionContext);
@@ -116,7 +117,7 @@ void QTimer::stop()
}
[m_timer invalidate];
- [m_timer release];
+ KWQRelease(m_timer);
m_timer = nil;
if (m_monitorFunction) {
@@ -136,7 +137,7 @@ void QTimer::fire()
m_timeoutSignal.call();
if (![m_timer isValid]) {
- [m_timer release];
+ KWQRelease(m_timer);
m_timer = nil;
}
}
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 3208757..12bcb2a 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -29,6 +29,7 @@
#import "KWQKHTMLPart.h"
#import "KWQLogging.h"
#import "KWQWindowWidget.h"
+#import "KWQFoundationExtras.h"
#import "WebCoreBridge.h"
#import "WebCoreFrameView.h"
#import "khtmlview.h"
@@ -66,14 +67,14 @@ QWidget::QWidget(NSView *view) : data(new KWQWidgetPrivate)
{
static QStyle defaultStyle;
data->style = &defaultStyle;
- data->view = [view retain];
+ data->view = KWQRetain(view);
data->visible = true;
}
QWidget::~QWidget()
{
KWQ_BLOCK_EXCEPTIONS;
- [data->view release];
+ KWQRelease(data->view);
KWQ_UNBLOCK_EXCEPTIONS;
delete data;
@@ -442,13 +443,10 @@ NSView *QWidget::getView() const
void QWidget::setView(NSView *view)
{
- if (view == data->view) {
- return;
- }
-
KWQ_BLOCK_EXCEPTIONS;
- [data->view release];
- data->view = [view retain];
+ KWQRetain(view);
+ KWQRelease(data->view);
+ data->view = view;
KWQ_UNBLOCK_EXCEPTIONS;
}
diff --git a/WebCore/kwq/WebCoreSettings.mm b/WebCore/kwq/WebCoreSettings.mm
index 5f97740..deecad4 100644
--- a/WebCore/kwq/WebCoreSettings.mm
+++ b/WebCore/kwq/WebCoreSettings.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,6 +25,7 @@
#import "WebCoreSettings.h"
+#import "KWQFoundationExtras.h"
#import "KWQKHTMLPart.h"
#import "KWQKHTMLSettings.h"
#import "WebCoreBridge.h"
@@ -46,6 +47,12 @@
[super dealloc];
}
+- (void)finalize
+{
+ delete settings;
+ [super finalize];
+}
+
- init
{
settings = new KHTMLSettings();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list