Fix build on current GNUstep and CALayer struct-property KVO crash#8
Open
pkgdemon wants to merge 2 commits into
Open
Fix build on current GNUstep and CALayer struct-property KVO crash#8pkgdemon wants to merge 2 commits into
pkgdemon wants to merge 2 commits into
Conversation
Author
|
Note this depends on gnustep/libs-opal#16 |
Author
|
@gcasa Here are fixes discussed in last GNUstep meeting. |
Author
|
@ivucica Let me know if this is something you might want, or if you foresee the need for a lot of changes. I did get libs-opal fixes merged so this will build now. |
Author
|
@ivucica Also something else from the readme I am not sure this is the case anymore: Patched Opal. Opal currently conflicts with AppKit. More specifically, it also implements an incompatible NSFont. An experimental patch is provided against r35173 of Opal in opal-nsfonthacks.patch. At least with my PR the demo app works fine, and no other patches required. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related changes so libs-quartzcore builds and the bundled demo
actually runs on current GNUstep/Linux:
current generation of GNUstep core (Foundation/CoreFoundation) and
against a non-Apple OpenGL.
(
bounds,position,anchorPoint,transform,sublayerTransform,contentsRect,shadowOffset) can no longer be registered forautomatic KVO observation on GNUstep — the autogenerated setter
overrides corrupt struct arguments passed by value through
objc_msgSend. The demo app crashed on startup before this.Build changes (
da7275a)Headers/QuartzCore/CABase.h— importFoundation/NSObject.hbeforeCoreFoundation.hso CF inline functions can resolve-hash/-isEqual:signatures. (Same pattern libs-opal needs on currentGNUstep.)
Headers/QuartzCore/CATransaction.h— switch from#import "CoreFoundation/CFDate.h"to#import <CoreFoundation/CoreFoundation.h>. The quoted per-headerpath doesn't resolve reliably against libs-corebase install layout.
Source/CABackingStore.h— move#define GL_GLEXT_PROTOTYPES 1outside the Apple-only block so non-Apple builds also get it, and
add
#import <GL/glext.h>for the non-Apple path.Source/GNUmakefile/config.make— minor flag adjustments forthe current toolchain.
.gitignore— ignoreobj/,derived_src/,*.framework/,*.app/.CALayer fix (
2ae02bb)CALayer -initused to register every property in its defaults listfor KVO observation via
CAImplicitAnimationObserver. On GNUstep thisworks for object-typed properties but breaks for struct-typed ones:
the KVO machinery generates a setter override that receives the struct
by value through
objc_msgSend, and on GNUstep the argument marshallingcorrupts the struct contents. Setting
bounds/position/etc. on afresh layer would then either crash or write garbage.
Changes in
Source/CALayer.m:structKeyslist:anchorPoint,transform,sublayerTransform,contentsRect,shadowOffset,bounds,position. These are excluded fromaddObserver:forKeyPath:.Their setters already emit willChange/didChange via
GSCA_OBSERVABLE_SETTER/ the manual-setBounds:/-setPosition:,so implicit animations still fire.
transformandsublayerTransformanalogous to the existing
shadowOffsetspecial-case: try KVC first,fall back to the typed setter inside NS_DURING / NS_HANDLER.
addObserver:in NS_DURING / NS_HANDLERso property types that don't support automatic KVO (e.g.
CGColorRef)don't abort
-init.#if 0debug block.Demo changes (
2ae02bb)Demo/AppController.m— remove the hand-rolledNSMenucreationunder
#if GNUSTEP. The main menu is already provided through thestandard GNUstep app loading path; the duplicate menu setup was a
leftover.
GSQuartzCoreDemo→QuartzCoreDemoin the Info.plist(
ApplicationName,NSExecutable) to match the current bundle name.DemoOpenGLView.m.Compatibility
additive to the existing Apple code paths.
through
<CoreFoundation/CoreFoundation.h>as expected.Testing
libs-corebase, libs-opal) on Devuan/Linux x86_64.
Demo/QuartzCore demo launches, the CALayer tree iscreated without crashing, and the root layer renders through the
GL view.