Continuously running daemon process CFConstantStringRefs build up over time

2010-10-01 Thread Kevin Ross
Greetings Cocoa Developers,

I have run into a snag while writing my background daemon and I was hoping that 
there might be some people on this list that could point me in the right 
direction or suggest a workaround.  I am writing a background daemon to handle 
to field incoming software update requests for several client applications 
running in the wild.  My implementation is working great, but I seem to have a 
slow buildup of CFConstantStringRefs that are being created by internal 
Foundation calls and CFSTR macros and are  never released.  This slowly builds 
up over time and there doesn't appear to be any way to release these strings.  

I have run the daemon through the clang static analyzer and the Instruments 
leaks tool but none are reporting any leaks.  I have even downloaded a fresh 
copy of valgrind from svn and it too is not finding anything.  The instruments 
allocation monitor is reporting that there are CFConstantStringRefs that 
Foundation is allocating from internal methods and CFSTR macros that I am using 
in some functions.  I'm happy to provide more details of the actual call-stacks 
and code if necessary.

Does anyone have any idea about what could be causing this or what I can do 
about it?  While this isn't a big deal in the short term, I have seen it build 
up fairly quickly during stress testing.  I have even tried setting hard and 
soft resource limits using the launchd plist by setting the MemoryLock and 
ResidentSetSize but these are not having the expected effect of limiting the 
memory buildup.

A work around I was contemplating was to have an idle timer that kills the app 
after a time if there are no active or incoming connections so it will then be 
restarted by launchd and reset the memory.  This seems like a hack to get 
around the problem and I think I must be overlooking something.

Any help would be greatly appreciated as I've tried googling and re-reading the 
background daemon tech notes and have turned up nothing.  Thank you for your 
help.

Sincerely,

Kevin Ross

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Continuously running daemon process CFConstantStringRefs build up over time

2010-10-01 Thread Kevin Ross
Thanks for your insight Dave,

In my current implementation I do have an autorelease pool being created and 
released at the end of main, as well as inside each posted notification that 
NSFileHandle posts on each background thread.  Upon further inspection the 
largest culprits are not CFConstantStringRefs but instead non-object 
allocations inside libsqlite3.dylib being called by sqlite3MemMalloc.  The 
constant strings are indeed building but are not the largest allocations.

With one save of the managedObjectContext libsqlite3.dylib mallocs 35 objects 
that are still considered live even after the NSOperation that is the root of 
the call stack has since been freed.

Here is the call-stack for one of the allocations since they all seem to follow 
the same call stack:
   0 libsqlite3.dylib sqlite3MemMalloc
   1 libsqlite3.dylib mallocWithAlarm
   2 libsqlite3.dylib pcache1Fetch
   3 libsqlite3.dylib sqlite3PcacheFetch
   4 libsqlite3.dylib sqlite3PagerAcquire
   5 libsqlite3.dylib sqlite3BtreeBeginTrans
   6 libsqlite3.dylib btreeCursor
   7 libsqlite3.dylib sqlite3InitOne
   8 libsqlite3.dylib sqlite3Init
   9 libsqlite3.dylib sqlite3Pragma
  10 libsqlite3.dylib yy_reduce
  11 libsqlite3.dylib sqlite3Parser
  12 libsqlite3.dylib sqlite3RunParser
  13 libsqlite3.dylib sqlite3LockAndPrepare
  14 CoreData -[NSSQLiteConnection _executeSQLString:]
  15 CoreData -[NSSQLiteConnection _configurePragmaOptions]
  16 CoreData -[NSSQLiteConnection connect]
  17 CoreData -[NSSQLCore _loadOrSetMetadata]
  18 CoreData -[NSSQLCore _ensureMetadataLoaded]
  19 CoreData -[NSSQLCore 
initWithPersistentStoreCoordinator:configurationName:URL:options:]
  20 CoreData -[NSPersistentStoreCoordinator 
addPersistentStoreWithType:configuration:URL:options:error:]
  21 MAID -[MIMaidServer persistentStoreCoordinator] 
/Users/kevin/Desktop/MAID_Workspace/MAID/MAID/Source/MIMaidServer.m:466
  22 MAID -[MIMaidServer managedObjectContext] 
/Users/kevin/Desktop/MAID_Workspace/MAID/MAID/Source/MIMaidServer.m:492
  23 MAID -[MIMaidOperation managedObjectContext] 
/Users/kevin/Desktop/MAID_Workspace/MAID/MAID/Source/MIMaidOperation.m:432
  24 MAID -[MIMaidOperation logClientData:] 
/Users/kevin/Desktop/MAID_Workspace/MAID/MAID/Source/MIMaidOperation.m:242
  25 MAID -[MIMaidOperation handleIncommingData:] 
/Users/kevin/Desktop/MAID_Workspace/MAID/MAID/Source/MIMaidOperation.m:230
  26 MAID -[MIMaidOperation dataReadFromClient:] 
/Users/kevin/Desktop/MAID_Workspace/MAID/MAID/Source/MIMaidOperation.m:210
  27 Foundation _nsnote_callback
  28 CoreFoundation __CFXNotificationPost
  29 CoreFoundation _CFXNotificationPostNotification
  30 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:]
  31 Foundation _performFileHandleSource
  32 CoreFoundation __CFRunLoopDoSources0
  33 CoreFoundation __CFRunLoopRun
  34 CoreFoundation CFRunLoopRunSpecific
  35 Foundation -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
  36 Foundation -[NSRunLoop(NSRunLoop) run]
  37 MAID -[MIMaidOperation main] 
/Users/kevin/Desktop/MAID_Workspace/MAID/MAID/Source/MIMaidOperation.m:165
  38 Foundation __NSThread__main__
  39 libSystem.B.dylib _pthread_start
  40 libSystem.B.dylib thread_start



With regard to the CFSTR being static within the executable

CFStringRef MICreateVersionStringFromVersionValue( UInt32 versionValue )
{
UniChar upperBase = 0;
UniChar lowerBase = 0;
UniChar major = 0;
UniChar minor = 0;

CFStringRef hexStringRef = CFStringCreateWithFormat( NULL, NULL, 
CFSTR(%x), versionValue );   - Instruments is hi-lighting this line as 
an allocation.

CFIndex sizeMatters = CFStringGetLength( hexStringRef );
//CFIndex charactersReturned = 0;

if ( sizeMatters  3 )
{
CFStringGetCharacters( hexStringRef, CFRangeMake( sizeMatters - 
4, 1 ), upperBase );
}
CFStringGetCharacters( hexStringRef, CFRangeMake( sizeMatters - 3, 1 ), 
lowerBase );
CFStringGetCharacters( hexStringRef, CFRangeMake( sizeMatters - 2, 1 ), 
major );
CFStringGetCharacters( hexStringRef, CFRangeMake( sizeMatters - 1, 1 ), 
minor );

CFStringRef versionStringRef = CFStringCreateWithFormat( NULL, NULL, 
CFSTR(%c%c.%c.%c), upperBase, lowerBase, major, minor );  - Instruments 
is hi-lighting this line as an allocation even though it is being released by 
the caller of the function.

CFRelease( hexStringRef );

return versionStringRef;
}

The returned versionStringRef is being released from the caller of the function 
and none of the other tools are reporting this as a leak so I'm not sure why 
the system is still considers any of the memory live.

Thanks for your help in this matter, it's been driving me crazy for a few days.

Sincerely,

Kevin Ross



On Oct 1, 2010, at 1:00 AM, Dave Keck wrote:

 Since you're writing a daemon, you'll need to handle autorelease-pool
 creation and draining manually

Re: Continuously running daemon process CFConstantStringRefs build up over time

2010-10-01 Thread Kevin Ross
Thanks a million Scott, 

I've started reading the sqlite documentation and it looks like I can adjust 
the PRAGMA cache_size to let me tweak the size of the cache.  I am only writing 
to the database with this daemon and I'll try to dig up any other options that 
might help optimize it for this scenario.  Those were the largest allocations 
in my testing and setting the cache to 10 seems to eliminate the outstanding 
malloc'ed objects.  

I still have some outstanding allocations from -[NSAutoeleasePool init] and 
+[NSRunLoop(NSRunLoop) currentRunLoop] that Foundation must be caching, but the 
memory overhead has drastically reduced under stress-testing.  

While I'm on the subject, are there any caveats to calling [[NSRunLoop 
currentRunLoop] run]; in the -(void)main of my NSOperation subclass?  In my 
testing it works wonderfully but I haven't read anything in the docs that say 
to avoid it.

Thanks again for your help,

Kevin Ross



On Oct 1, 2010, at 1:20 PM, Scott Ribe wrote:

 On Oct 1, 2010, at 2:15 PM, Kevin Ross wrote:
 
 libsqlite3.dylib mallocs 35 objects that are still considered live
 
 Sqlite manages its own cache.
 
 -- 
 Scott Ribe
 scott_r...@elevated-dev.com
 http://www.elevated-dev.com/
 (303) 722-0567 voice
 
 
 
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Questions on using using modal sheets with Core Data

2009-06-14 Thread Kevin Ross
I'm able to get the dependent values to update correctly if I access  
the deepest path of the relationship before I set the value that will  
cause them to update.


It seems like kind of a kludge, but it might be the best I can do  
right now until I can ferret out a possible missed dependency somewhere.



Thanks for the tips!

Kevin


On Jun 12, 2009, at 12:55 PM, Kevin Ross wrote:


Thanks Dave,
I'm creating a new MOC in the sheet and hooking it up to the same  
persistent store as the document, so when the NSArrayController  
performs it's initial fetch at load (I have it set in IB to  
automatically prepare content).  I'm not actually using this context  
to add or remove any entities, only changing the properties.  Each  
selectable managed object (an instance of FloorPlanMO) in the  
NSArrayController  has a 1-1 relationship with an entity called  
FlyingStarsMO.  This entity has 4 integer attributes that are  
dependent upon values in the FloorPlanMO as well as some of the  
values being inter-dependent amongst themselves.  Here is the code  
for the keyPathsForValuesAffectingKeys: of the FlyingStarMO.  The  
only value that I'm changing in this sheet is located at  
@floorPlan.house.yearOfLastMajorRenovation.  I'm only changing the  
integer value, not adding or deleting anything.



+ (NSSet *)keyPathsForValuesAffectingMountainStar; {
   return [NSSet setWithObjects:@floorPlan.sittingDirection,  
@floorPlan.facingDirection, @loShuAgeStar, @floorPlan,  
@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingWaterStar; {
   return [NSSet setWithObjects:@floorPlan.sittingDirection,  
@floorPlan.facingDirection, @loShuAgeStar, @floorPlan,  
@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingLoShuAgeStar; {
   return [NSSet  
setWithObjects:@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingAnnualStar; {
   return [NSSet  
setWithObjects:@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingStarChart; {
   return [NSSet setWithObjects:@mountainStar, @annualStar,  
@waterStar, @loShuAgeStar, nil];

}

The strange thing is that if I select all of the objects in the  
NSArrayController first, and then change the value of  
yearOfLastMajorRenovation, all the values in the StarChartMO get  
updated in each FloorPlanMO like I want.  But only after I've  
selected the objects in the array controller first.   From then on  
all is well and each FloorPlanMO in the NSArrayController gets  
updated when the yearOfLastMajorRenovation changes.


Everything updates fine when the arrayController is bound to the  
document's MOC, but not when bound from the sheet's MOC.  I'm going  
back and checking to make sure I have all my dependencies accounted  
for in keyPathsForValuesAffectingKeys:.  Perhaps something isn't  
being accounted for but was hidden because of the inter-dependencies?


Thanks again for taking the time to read this, and I need to provide  
more information just let me know.


Kevin



On Jun 12, 2009, at 12:03 PM, Dave Fernandes wrote:


Kevin,
You'll have to say a bit more about how you adapted the example. Do  
you create a new MOC and create new objects within it with  
attributes copied from the document MOC? Is there a Core Data  
relationship between these two new objects? What do you mean by  
dependent on others and propogated? Is there some KVO  
dependence, or have you defined  
keyPathsForValuesAffectingValueForKey: or used the deprecated  
setKeys:triggerChangeNotificationsForDependentKey:?


Dave

On Jun 12, 2009, at 12:59 PM, Kevin Ross wrote:

I adapted the examples in the NSPersistentDocument tutorial, and  
this works great.  The problem I'm having is with some of the  
state management because some of the properties are dependent upon  
others.  I'll try to explain how the relationship works.


Let's say we have 2 objects in the sheet's MOC.  When the sheet is  
first opened, the selected object of the arrayController is fully  
fetched and realized, but the second object hasn't fetched the  
values from the MOC yet, so it's values aren't updated with the  
first object when I change some of the parameters.  If I select  
each object first to fetch the properties from the backing-store,  
then when I change a value it is immediately propagated as it  
should.  Do I have to try and access the values programmatically  
so the objects become fully realized before I display the sheet?   
I have the controller set to automatically prepare content, should  
I turn that off and manually perform the fetches?


Thanks for your time,

Kevin



On Jun 11, 2009, at 8:31 PM, Dave Fernandes wrote:


This is explained in the NSPersistentDocument tutorial in the docs.

On Jun 11, 2009, at 10:03 PM, Kevin Ross wrote:

Hi all, have a Core Data document based application which uses  
modal sheets as a way for the user to edit the document's data

Re: Questions on using using modal sheets with Core Data

2009-06-12 Thread Kevin Ross
I adapted the examples in the NSPersistentDocument tutorial, and this  
works great.  The problem I'm having is with some of the state  
management because some of the properties are dependent upon others.   
I'll try to explain how the relationship works.


Let's say we have 2 objects in the sheet's MOC.  When the sheet is  
first opened, the selected object of the arrayController is fully  
fetched and realized, but the second object hasn't fetched the values  
from the MOC yet, so it's values aren't updated with the first object  
when I change some of the parameters.  If I select each object first  
to fetch the properties from the backing-store, then when I change a  
value it is immediately propagated as it should.  Do I have to try and  
access the values programmatically so the objects become fully  
realized before I display the sheet?  I have the controller set to  
automatically prepare content, should I turn that off and manually  
perform the fetches?


Thanks for your time,

Kevin



On Jun 11, 2009, at 8:31 PM, Dave Fernandes wrote:


This is explained in the NSPersistentDocument tutorial in the docs.

On Jun 11, 2009, at 10:03 PM, Kevin Ross wrote:

Hi all, have a Core Data document based application which uses  
modal sheets as a way for the user to edit the document's data.   
What is the best way to give the sheet the ability to operate on a  
copy of the data with the parents sheet's undo context?  And how  
best to merge these changes with the main document context.


I've thought of having a unique MOC for each sheet, and then  
posting a custom notification that would in turn cause each MOC to  
perform something like:


for (id object in [managedObjectContext registeredObjects]) {
[managedObjectContext refreshObject:object
   mergeChanges:YES];
}

Does this way make any sense?  Is there a better way to do this  
that I'm missing?


Thanks for any pointers!

Kevin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca

This email sent to dave.fernan...@utoronto.ca





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Questions on using using modal sheets with Core Data

2009-06-12 Thread Kevin Ross

Thanks Dave,
I'm creating a new MOC in the sheet and hooking it up to the same  
persistent store as the document, so when the NSArrayController  
performs it's initial fetch at load (I have it set in IB to  
automatically prepare content).  I'm not actually using this context  
to add or remove any entities, only changing the properties.  Each  
selectable managed object (an instance of FloorPlanMO) in the  
NSArrayController  has a 1-1 relationship with an entity called  
FlyingStarsMO.  This entity has 4 integer attributes that are  
dependent upon values in the FloorPlanMO as well as some of the values  
being inter-dependent amongst themselves.  Here is the code for the  
keyPathsForValuesAffectingKeys: of the FlyingStarMO.  The only value  
that I'm changing in this sheet is located at  
@floorPlan.house.yearOfLastMajorRenovation.  I'm only changing the  
integer value, not adding or deleting anything.



+ (NSSet *)keyPathsForValuesAffectingMountainStar; {
return [NSSet setWithObjects:@floorPlan.sittingDirection,  
@floorPlan.facingDirection, @loShuAgeStar, @floorPlan,  
@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingWaterStar; {
return [NSSet setWithObjects:@floorPlan.sittingDirection,  
@floorPlan.facingDirection, @loShuAgeStar, @floorPlan,  
@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingLoShuAgeStar; {
return [NSSet  
setWithObjects:@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingAnnualStar; {
return [NSSet  
setWithObjects:@floorPlan.house.yearOfLastMajorRenovation, nil];

}

+ (NSSet *)keyPathsForValuesAffectingStarChart; {
return [NSSet setWithObjects:@mountainStar, @annualStar,  
@waterStar, @loShuAgeStar, nil];

}

The strange thing is that if I select all of the objects in the  
NSArrayController first, and then change the value of  
yearOfLastMajorRenovation, all the values in the StarChartMO get  
updated in each FloorPlanMO like I want.  But only after I've selected  
the objects in the array controller first.   From then on all is well  
and each FloorPlanMO in the NSArrayController gets updated when the  
yearOfLastMajorRenovation changes.


Everything updates fine when the arrayController is bound to the  
document's MOC, but not when bound from the sheet's MOC.  I'm going  
back and checking to make sure I have all my dependencies accounted  
for in keyPathsForValuesAffectingKeys:.  Perhaps something isn't being  
accounted for but was hidden because of the inter-dependencies?


Thanks again for taking the time to read this, and I need to provide  
more information just let me know.


Kevin



On Jun 12, 2009, at 12:03 PM, Dave Fernandes wrote:


Kevin,
You'll have to say a bit more about how you adapted the example. Do  
you create a new MOC and create new objects within it with  
attributes copied from the document MOC? Is there a Core Data  
relationship between these two new objects? What do you mean by  
dependent on others and propogated? Is there some KVO  
dependence, or have you defined  
keyPathsForValuesAffectingValueForKey: or used the deprecated  
setKeys:triggerChangeNotificationsForDependentKey:?


Dave

On Jun 12, 2009, at 12:59 PM, Kevin Ross wrote:

I adapted the examples in the NSPersistentDocument tutorial, and  
this works great.  The problem I'm having is with some of the state  
management because some of the properties are dependent upon  
others.  I'll try to explain how the relationship works.


Let's say we have 2 objects in the sheet's MOC.  When the sheet is  
first opened, the selected object of the arrayController is fully  
fetched and realized, but the second object hasn't fetched the  
values from the MOC yet, so it's values aren't updated with the  
first object when I change some of the parameters.  If I select  
each object first to fetch the properties from the backing-store,  
then when I change a value it is immediately propagated as it  
should.  Do I have to try and access the values programmatically so  
the objects become fully realized before I display the sheet?  I  
have the controller set to automatically prepare content, should I  
turn that off and manually perform the fetches?


Thanks for your time,

Kevin



On Jun 11, 2009, at 8:31 PM, Dave Fernandes wrote:


This is explained in the NSPersistentDocument tutorial in the docs.

On Jun 11, 2009, at 10:03 PM, Kevin Ross wrote:

Hi all, have a Core Data document based application which uses  
modal sheets as a way for the user to edit the document's data.   
What is the best way to give the sheet the ability to operate on  
a copy of the data with the parents sheet's undo context?  And  
how best to merge these changes with the main document context.


I've thought of having a unique MOC for each sheet, and then  
posting a custom notification that would in turn cause each MOC  
to perform something like:


for (id object

Questions on using using modal sheets with Core Data

2009-06-11 Thread Kevin Ross
Hi all, have a Core Data document based application which uses modal  
sheets as a way for the user to edit the document's data.  What is the  
best way to give the sheet the ability to operate on a copy of the  
data with the parents sheet's undo context?  And how best to merge  
these changes with the main document context.


I've thought of having a unique MOC for each sheet, and then posting a  
custom notification that would in turn cause each MOC to perform  
something like:


for (id object in [managedObjectContext registeredObjects]) {
[managedObjectContext refreshObject:object
   mergeChanges:YES];
}

Does this way make any sense?  Is there a better way to do this that  
I'm missing?


Thanks for any pointers!

Kevin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Questions on using using modal sheets with Core Data

2009-06-11 Thread Kevin Ross
Jeez, I forgot to explain that posting the notification would happen  
when the user accepts the changes made in the modal window.  I hope it  
make a little more sense now.


Thanks,

Kevin



On Jun 11, 2009, at 7:03 PM, Kevin Ross wrote:

Hi all, have a Core Data document based application which uses modal  
sheets as a way for the user to edit the document's data.  What is  
the best way to give the sheet the ability to operate on a copy of  
the data with the parents sheet's undo context?  And how best to  
merge these changes with the main document context.


I've thought of having a unique MOC for each sheet, and then posting  
a custom notification that would in turn cause each MOC to perform  
something like:


for (id object in [managedObjectContext registeredObjects]) {
[managedObjectContext refreshObject:object
   mergeChanges:YES];
}

Does this way make any sense?  Is there a better way to do this that  
I'm missing?


Thanks for any pointers!

Kevin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/apple-lists%40twentyfourmountains.com

This email sent to apple-li...@twentyfourmountains.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Printing a layer-backed NSView

2009-06-09 Thread Kevin Ross
I can't seem to find mention of printing a layer-hosted NSView in the  
documentation anywhere.Printing works on my view when the view is  
set to wantsLayer = NO, but draws nothing when all the drawing takes  
place in the hosted CALayer with = YES.  Is there something I'm  
missing to get the view to print?


Thanks for any suggestions!

Kevin Ross
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Setting wantsLayer = YES; crashes on view load.

2009-06-02 Thread Kevin Ross
Turns out I did have an spurious NSNotificationCenter registration in  
a loaded view that was causing the crash.  Thank you for your help  
Michael!



On Jun 1, 2009, at 7:31 PM, Kevin Ross wrote:

I looked at the msgSends dump of everything after setWantsLayer, and  
at the end it looks like a NSAutoreleasePool is being created right  
before a CAContext is initialized.  It then throws an exception  
right after NSCFString NSCFString copyWithZone:.



+ NSAutoreleasePool NSObject alloc
+ NSAutoreleasePool NSAutoreleasePool allocWithZone:
+ NSAutoreleasePool NSObject self
- NSAutoreleasePool NSAutoreleasePool init
- NSAutoreleasePool NSAutoreleasePool initWithCapacity:
- NSAutoreleasePool NSObject class
+ NSAutoreleasePool NSObject self
+ CAContext NSObject initialize
+ CAContext CAContext localContext
+ CAContext CAContext localContextWithOptions:
+ CAContextImpl CAContextImpl initialize
+ CAContextImpl NSObject alloc
+ CAContextImpl NSObject allocWithZone:
- CAContextImpl CAContextImpl initWithOptions:
- CAContext NSObject init
+ NSConcreteNotification NSConcreteNotification  
newTempNotificationWithName:object:userInfo:

- NSCFString NSCFString copyWithZone:


Is there a way using instruments or dtrace to find out what objects  
are being passed to newTempNotificationWithName:object:userInfo?



Thank you for your time,

Kevin



On Jun 1, 2009, at 1:27 PM, Kevin Ross wrote:


Thanks Michael,

I do have a few notifications registered throughout the app, but  
nothing that is connected with any of the CALayers or views.  This  
seems to happen no matter which view or nib I use.  I'm trying to  
see if I can isolate the notification that is causing  the crash.




On Jun 1, 2009, at 12:07 AM, Michael Vannorsdel wrote:

Are you registering for any notifications?  It looks like it's  
crashing while trying to notify an object.



On Jun 1, 2009, at 12:31 AM, Kevin Ross wrote:

Hi everyone, I have a Core Data document based app that I've been  
working on for a while and I now want to change some of the view  
drawing to use CALayers.  The trouble I'm having is that when I  
set a view's wantsLayer = YES, I end up getting  
EXC_BAD_ACCESS.This happens when I try to set it on any  
arbitrary view in any of the nibs in my project, when setting it  
from code, or from clicking the checkbox in IB.  I've tried new  
CALayer projects from scratch and they work fine, is there  
something I could have done to my project that would prevent me  
from setting a view's wantsLayer property to YES?


Thank you for taking time to read this.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/apple-lists%40twentyfourmountains.com

This email sent to apple-li...@twentyfourmountains.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/apple-lists%40twentyfourmountains.com

This email sent to apple-li...@twentyfourmountains.com






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Setting wantsLayer = YES; crashes on view load.

2009-06-01 Thread Kevin Ross
Hi everyone, I have a Core Data document based app that I've been  
working on for a while and I now want to change some of the view  
drawing to use CALayers.  The trouble I'm having is that when I set a  
view's wantsLayer = YES, I end up getting EXC_BAD_ACCESS.This  
happens when I try to set it on any arbitrary view in any of the nibs  
in my project, when setting it from code, or from clicking the  
checkbox in IB.  I've tried new CALayer projects from scratch and they  
work fine, is there something I could have done to my project that  
would prevent me from setting a view's wantsLayer property to YES?


Thank you for taking time to read this.

Kevin Ross


Stack Trace of crash:

#0  0x9129c688 in objc_msgSend ()
#1  0x91bbe7a6 in +[NSConcreteNotification  
newTempNotificationWithName:object:userInfo:] ()

#2  0x91bc158d in _nsnote_callback ()
#3  0x951fa64a in __CFXNotificationPost ()
#4  0x951fa923 in _CFXNotificationPostNotification ()
#5  0x951fac18 in CFNotificationCenterPostNotification ()
#6  0x9368250c in CARenderContextNew ()
#7  0x9365671a in -[CAContextImpl initWithOptions:] ()
#8  0x936823cf in +[CAContext localContextWithOptions:] ()
#9  0x93682386 in +[CAContext localContext] ()
#10 0x93682296 in CAViewCreate ()
#11 0x930643d0 in -[NSView(NSInternal) _createLayerTreeRenderer] ()
#12 0x930642ac in -[NSView(NSLayerKitGlue)  
_setUpLayerTreeRendererAndSurface] ()

#13 0x92df5e51 in -[NSView lockFocusIfCanDraw] ()
#14 0x92df58b1 in -[NSView lockFocus] ()
#15 0x92df9c4b in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#16 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#17 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#18 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#19 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#20 0x92df8679 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] ()
#21 0x92df7fbb in -[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] ()
#22 0x92df4adf in -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()

#23 0x92d354b3 in -[NSView displayIfNeeded] ()
#24 0x92d35061 in -[NSWindow displayIfNeeded] ()
#25 0x92df0c37 in -[NSWindow  
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()

#26 0x92df0690 in -[NSWindow orderWindow:relativeTo:] ()
#27 0x92e2270d in -[NSWindow orderFront:] ()
#28 0x92d03503 in -[NSIBObjectData  
nibInstantiateWithOwner:topLevelObjects:] ()

#29 0x92cf9616 in loadNib ()
#30 0x92cf8f78 in +[NSBundle(NSNibLoading)  
_loadNibFile:nameTable:withZone:ownerBundle:] ()
#31 0x92cf8bbb in +[NSBundle(NSNibLoading)  
loadNibFile:externalNameTable:withZone:] ()

#32 0x92d38ed9 in -[NSWindowController loadWindow] ()
#33 0x92d38c72 in -[NSWindowController window] ()
#34 0x92d38b9a in -[NSWindowController showWindow:] ()
#35 0x92d38add in -[NSDocument showWindows] ()
#36 0x92d36da4 in -[NSDocumentController  
openUntitledDocumentAndDisplay:error:] ()

#37 0x92f229ea in -[NSDocumentController newDocument:] ()
#38 0x92e044cb in -[NSApplication sendAction:to:from:] ()
#39 0x92eb3108 in -[NSMenu performActionForItemAtIndex:] ()
#40 0x92eb2e0d in -[NSCarbonMenuImpl  
performActionWithHighlightingForItemAtIndex:] ()

#41 0x92eb2a93 in -[NSMenu performKeyEquivalent:] ()
#42 0x92eb1338 in -[NSApplication _handleKeyEquivalent:] ()
#43 0x92dce0fb in -[NSApplication sendEvent:] ()
#44 0x92d2b62f in -[NSApplication run] ()
#45 0x92cf8834 in NSApplicationMain ()






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Setting wantsLayer = YES; crashes on view load.

2009-06-01 Thread Kevin Ross

Thanks Michael,

I do have a few notifications registered throughout the app, but  
nothing that is connected with any of the CALayers or views.  This  
seems to happen no matter which view or nib I use.  I'm trying to see  
if I can isolate the notification that is causing  the crash.




On Jun 1, 2009, at 12:07 AM, Michael Vannorsdel wrote:

Are you registering for any notifications?  It looks like it's  
crashing while trying to notify an object.



On Jun 1, 2009, at 12:31 AM, Kevin Ross wrote:

Hi everyone, I have a Core Data document based app that I've been  
working on for a while and I now want to change some of the view  
drawing to use CALayers.  The trouble I'm having is that when I set  
a view's wantsLayer = YES, I end up getting EXC_BAD_ACCESS.This  
happens when I try to set it on any arbitrary view in any of the  
nibs in my project, when setting it from code, or from clicking the  
checkbox in IB.  I've tried new CALayer projects from scratch and  
they work fine, is there something I could have done to my project  
that would prevent me from setting a view's wantsLayer property to  
YES?


Thank you for taking time to read this.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/apple-lists%40twentyfourmountains.com

This email sent to apple-li...@twentyfourmountains.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Setting wantsLayer = YES; crashes on view load.

2009-06-01 Thread Kevin Ross
I looked at the msgSends dump of everything after setWantsLayer, and  
at the end it looks like a NSAutoreleasePool is being created right  
before a CAContext is initialized.  It then throws an exception right  
after NSCFString NSCFString copyWithZone:.



+ NSAutoreleasePool NSObject alloc
+ NSAutoreleasePool NSAutoreleasePool allocWithZone:
+ NSAutoreleasePool NSObject self
- NSAutoreleasePool NSAutoreleasePool init
- NSAutoreleasePool NSAutoreleasePool initWithCapacity:
- NSAutoreleasePool NSObject class
+ NSAutoreleasePool NSObject self
+ CAContext NSObject initialize
+ CAContext CAContext localContext
+ CAContext CAContext localContextWithOptions:
+ CAContextImpl CAContextImpl initialize
+ CAContextImpl NSObject alloc
+ CAContextImpl NSObject allocWithZone:
- CAContextImpl CAContextImpl initWithOptions:
- CAContext NSObject init
+ NSConcreteNotification NSConcreteNotification  
newTempNotificationWithName:object:userInfo:

- NSCFString NSCFString copyWithZone:


Is there a way using instruments or dtrace to find out what objects  
are being passed to newTempNotificationWithName:object:userInfo?



Thank you for your time,

Kevin



On Jun 1, 2009, at 1:27 PM, Kevin Ross wrote:


Thanks Michael,

I do have a few notifications registered throughout the app, but  
nothing that is connected with any of the CALayers or views.  This  
seems to happen no matter which view or nib I use.  I'm trying to  
see if I can isolate the notification that is causing  the crash.




On Jun 1, 2009, at 12:07 AM, Michael Vannorsdel wrote:

Are you registering for any notifications?  It looks like it's  
crashing while trying to notify an object.



On Jun 1, 2009, at 12:31 AM, Kevin Ross wrote:

Hi everyone, I have a Core Data document based app that I've been  
working on for a while and I now want to change some of the view  
drawing to use CALayers.  The trouble I'm having is that when I  
set a view's wantsLayer = YES, I end up getting EXC_BAD_ACCESS. 
This happens when I try to set it on any arbitrary view in any of  
the nibs in my project, when setting it from code, or from  
clicking the checkbox in IB.  I've tried new CALayer projects from  
scratch and they work fine, is there something I could have done  
to my project that would prevent me from setting a view's  
wantsLayer property to YES?


Thank you for taking time to read this.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/apple-lists%40twentyfourmountains.com

This email sent to apple-li...@twentyfourmountains.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/apple-lists%40twentyfourmountains.com

This email sent to apple-li...@twentyfourmountains.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSAccessibilityAttributeValue exception raised when hovering mouse over top menu bar

2009-05-11 Thread Kevin Ross
Hi everyone, I'm experiencing a strange exception that is being thrown  
when I start the app in the debugger.  It loads the symbols fine and  
even starts the app okay.  But when I use the top menu at all (even  
just hovering the mouse over the menu bar does it) it raises this  
exception.  During a normal run, this isn't affecting the app's  
noticeably, but it does make it difficult to use the debugger with a  
breakpoint set on -[NSException raise] since it will break constantly  
when the mouse moves near the menu.  It appears that even command key  
equivalents do not bypass this.  I've just recently noticed this  
behavior, but I haven't worked on this project in about a month.  I  
believe that the last major change I made was replacing any non- 
localized user-visible strings with NSLocalizedStrings.  I don't  
remember seeing this after but might this be the culprit?


Also, here is the backtrace:
#0  0x930acc26 in -[NSException raise] ()
#1  0x94f2de4e in NSAccessibilityAttributeValue ()
#2  0x95218c3b in CopyAppKitUIElementAttributeValueNoCatch ()
#3  0x952190b7 in CopyAttributeValue ()
#4  0x929a2afc in _AXXMIGCopyAttributeValue ()
#5  0x929a9da1 in _XCopyAttributeValue ()
#6  0x929734d8 in mshMIGPerform ()
#7  0x930338e8 in CFRunLoopRunSpecific ()
#8  0x93033cd8 in CFRunLoopRunInMode ()
#9  0x943d62c0 in RunCurrentEventLoopInMode ()
#10 0x943d60d9 in ReceiveNextEventCommon ()
#11 0x943d5f4d in BlockUntilNextEventMatchingListInMode ()
#12 0x94e8cd7d in _DPSNextEvent ()
#13 0x94e8c630 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:] ()

#14 0x94e8566b in -[NSApplication run] ()
#15 0x94e528a4 in NSApplicationMain ()
#16 0x2af2 in main (argc=5, argv=0xb5fc)


Thank you all for any suggestions you may have,

Kevin Ross



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSString and Leaks Instrument, False Positives?

2009-03-23 Thread Kevin Ross
Thanks Bill, I've reported the problem to bugreporter (#6710982).   
Thanks for helping figure it out!


Kevin

On Mar 21, 2009, at 5:33 PM, Bill Bumgarner wrote:


On Mar 21, 2009, at 5:09 PM, Kevin Ross wrote:
KRStarChartMO drawPortentsInRect:circleStyle:] | +[NSFont  
fontWithName:size:] | __NSFontFactoryWithName | + 
[__NSFontTypefaceInfo typefaceInfoForPostscriptName:] |  
TDescriptor::CreateMatchingDescriptorInternal(__CFSet const*) const  
|  
TDescriptorSourceImp 
::CopyFontDescriptorPerPostscriptName(__CFString const*, unsigned  
int) const | ATSFontFindFromPostScriptName |  
_eATSFontFindFromPostScriptName | _eATSSendFontQuery |  
CFStringCreateWithCString | __CFStringCreateImmutableFunnel3 |  
_CFRuntimeCreateInstance | malloc_zone_malloc


That looks an awful lot like a leak in the ATS subsystem.

File a bug via http://bugreport.apple.com/ and send me the #, please.

b.bum



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSString and Leaks Instrument, False Positives?

2009-03-21 Thread Kevin Ross
Hi everyone, I'm auditing my app and the both the leaks command line  
tool and the Instruments tool are both reporting that I have NSString  
leaks.  All of the leaks are coming from code similar to the following:


NSFont *ageStarTextFont = [NSFont fontWithName:@Arial Bold  
size:KRLesserDimensionOfRect(transientDrawingRect)/3];


I'm guessing that the string in question is the @Arial Bold since it  
that is the only string on that line, but from what I understand a  
string created like that doesn't require a -release message.  Could  
these be false positives generated by the leaks tool, or is there  
something that I'm missing?


Thanks for any pointers!


Kevin Ross

Twenty-Four Mountains
Mac Feng Shui Software
ke...@twentyfourmountains.com
twentyfourmountains.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSString and Leaks Instrument, False Positives?

2009-03-21 Thread Kevin Ross
Whoops, I thought that I'd also mention that I've run the code though  
the clang static analyzer and it doesn't report that there are any  
bugs.  I'm also happy to post more code if it will help.


Thanks again!

Kevin


On Mar 21, 2009, at 4:36 PM, Kevin Ross wrote:

Hi everyone, I'm auditing my app and the both the leaks command  
line tool and the Instruments tool are both reporting that I have  
NSString leaks.  All of the leaks are coming from code similar to  
the following:


NSFont *ageStarTextFont = [NSFont fontWithName:@Arial Bold  
size:KRLesserDimensionOfRect(transientDrawingRect)/3];


I'm guessing that the string in question is the @Arial Bold since  
it that is the only string on that line, but from what I understand  
a string created like that doesn't require a -release message.   
Could these be false positives generated by the leaks tool, or is  
there something that I'm missing?


Thanks for any pointers!


Kevin Ross

Twenty-Four Mountains
Mac Feng Shui Software
ke...@twentyfourmountains.com
twentyfourmountains.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/faderanger%40sbcglobal.net

This email sent to faderan...@sbcglobal.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSString and Leaks Instrument, False Positives?

2009-03-21 Thread Kevin Ross

Ummm  Here is some truncated output from the command line leaks:

Leak: 0x15fd4970  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd4990  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd49c0  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd49e0  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd4a00  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd4a20  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd4a40  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd4a60  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd4a80  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.
Leak: 0x15fd4ac0  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.


Is that what you are asking about?



Kevin



On Mar 21, 2009, at 4:51 PM, mm w wrote:


be careful with clang, sometimes is missing point,
your problem is coming not from this @Arial Bold,
give the complete stack and explain what is the condition of the leak

False/positive: I have an extensive use of perf tools since years and
I didn't see that since a while
the leak can be deeper than your app ===  give the complete stack- 
trace


On Sat, Mar 21, 2009 at 4:43 PM, Kevin Ross  
faderan...@sbcglobal.net wrote:
Whoops, I thought that I'd also mention that I've run the code  
though the
clang static analyzer and it doesn't report that there are any  
bugs.  I'm

also happy to post more code if it will help.

Thanks again!

Kevin


On Mar 21, 2009, at 4:36 PM, Kevin Ross wrote:

Hi everyone, I'm auditing my app and the both the leaks command  
line
tool and the Instruments tool are both reporting that I have  
NSString leaks.

 All of the leaks are coming from code similar to the following:

NSFont *ageStarTextFont = [NSFont fontWithName:@Arial Bold
size:KRLesserDimensionOfRect(transientDrawingRect)/3];

I'm guessing that the string in question is the @Arial Bold  
since it
that is the only string on that line, but from what I understand a  
string
created like that doesn't require a -release message.  Could these  
be false
positives generated by the leaks tool, or is there something that  
I'm

missing?

Thanks for any pointers!


Kevin Ross

Twenty-Four Mountains
Mac Feng Shui Software
ke...@twentyfourmountains.com
twentyfourmountains.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

http://lists.apple.com/mailman/options/cocoa-dev/faderanger%40sbcglobal.net

This email sent to faderan...@sbcglobal.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com

This email sent to openspec...@gmail.com





--
-mmw



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do

Re: NSString and Leaks Instrument, False Positives?

2009-03-21 Thread Kevin Ross

Here's the block of surrounding code:

NSFont *ageStarTextFont = [NSFont fontWithName:@Arial Bold

  
size:KRLesserDimensionOfRect(transientDrawingRect)/3];
	NSMutableDictionary *txtAttributes = [NSMutableDictionary  
dictionaryWithObject:ageStarTextFont



forKey:NSFontAttributeName];

/* Add a white outline attribute for 
readability */
//	NSColor *textStrokeColor = [[NSColor whiteColor]  
colorWithAlphaComponent:0.7];

[txtAttributes setObject:[NSNumber 
numberWithFloat:-6.0]
  
forKey:NSStrokeWidthAttributeName];
[txtAttributes setObject:textStrokeColor
  
forKey:NSStrokeColorAttributeName];

/* Draw the string for the age star in 
the grid */
NSString *ageStarInfo = 
[portent.ageStar stringValue];
[ageStarInfo drawCenteredInRect: 
centerBox
 
withAttributes: txtAttributes];


Any ideas?

Thanks,

Kevin


On Mar 21, 2009, at 4:51 PM, mm w wrote:


be careful with clang, sometimes is missing point,
your problem is coming not from this @Arial Bold,
give the complete stack and explain what is the condition of the leak

False/positive: I have an extensive use of perf tools since years and
I didn't see that since a while
the leak can be deeper than your app ===  give the complete stack- 
trace


On Sat, Mar 21, 2009 at 4:43 PM, Kevin Ross  
faderan...@sbcglobal.net wrote:
Whoops, I thought that I'd also mention that I've run the code  
though the
clang static analyzer and it doesn't report that there are any  
bugs.  I'm

also happy to post more code if it will help.

Thanks again!

Kevin


On Mar 21, 2009, at 4:36 PM, Kevin Ross wrote:

Hi everyone, I'm auditing my app and the both the leaks command  
line
tool and the Instruments tool are both reporting that I have  
NSString leaks.

 All of the leaks are coming from code similar to the following:

NSFont *ageStarTextFont = [NSFont fontWithName:@Arial Bold
size:KRLesserDimensionOfRect(transientDrawingRect)/3];

I'm guessing that the string in question is the @Arial Bold  
since it
that is the only string on that line, but from what I understand a  
string
created like that doesn't require a -release message.  Could these  
be false
positives generated by the leaks tool, or is there something that  
I'm

missing?

Thanks for any pointers!


Kevin Ross

Twenty-Four Mountains
Mac Feng Shui Software
ke...@twentyfourmountains.com
twentyfourmountains.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

http://lists.apple.com/mailman/options/cocoa-dev/faderanger%40sbcglobal.net

This email sent to faderan...@sbcglobal.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com

This email sent to openspec...@gmail.com





--
-mmw


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSString and Leaks Instrument, False Positives?

2009-03-21 Thread Kevin Ross
  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] |  
-[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] | -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] | -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] | -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] | -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] | -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] | -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] | - 
[NSView _drawRect:clip:] | -[KRMiniGridStarChartView drawRect:] | - 
[KRStarChartMO drawPortentsInRect:circleStyle:] | +[NSFont  
fontWithName:size:] | __NSFontFactoryWithName | +[__NSFontTypefaceInfo  
typefaceInfoForPostscriptName:] |  
TDescriptor::CreateMatchingDescriptorInternal(__CFSet const*) const |  
TDescriptorSourceImp::CopyFontDescriptorPerPostscriptName(__CFString  
const*, unsigned int) const | ATSFontFindFromPostScriptName |  
_eATSFontFindFromPostScriptName | _eATSSendFontQuery |  
CFStringCreateWithCString | __CFStringCreateImmutableFunnel3 |  
_CFRuntimeCreateInstance | malloc_zone_malloc
Leak: 0x15fb84f0  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.






On Mar 21, 2009, at 5:02 PM, Bill Bumgarner wrote:


On Mar 21, 2009, at 4:56 PM, Kevin Ross wrote:
Leak: 0x15fd4ac0  size=32	instance of 'NSCFString', type ObjC,  
implemented in CoreFoundation	

0xa00664a0 0x0100078c 0x5354410e 0x65755120 .d...ATS Que
0x50207972 0x0074726f 0x 0x ry Port.


Is that what you are asking about?


Almost.   Now, set the MallocStackLoggingNoCompact environment  
variable in the process you are testing (you can do so via the  
Executables inspector in Xcode or 'set env  
MallocStackLoggingNoCompact=1' in gdb) and use 'leaks' again.


b.bum




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data, Garbage Collection and SQL Store

2009-01-31 Thread Kevin Ross
I've been trying in vain to reproduce this bug on my computer (c2duo)  
and my wife's computer (G4) to no avail.  Also the output from - 
com.apple.CoreData.SQLDebug 1 doesn't seem unusual at all.  Maybe I'll  
try some tests with using large photos and see it there's a  
significant slowdown when writing atomically versus w/ SQL.


-K

On Jan 30, 2009, at 3:09 PM, Kevin Ross wrote:




On Jan 30, 2009, at 3:02 PM, Sean McBride wrote:


On 1/30/09 2:49 PM, Kevin Ross said:

If it's not too much trouble are you able to send me your repro  
project?

I'm wondering why it's not happening with my project anymore.


I'm afraid the bug I filed contains not a simple test project, but my
entire (unreleased) application.  I wanted to be sure they fixed my
exact case.

Sorry,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




No problem, thanks anyway Sean!

Kevin Ross
Feng Shui Software
cocoabeans.heliohost.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoa.beans%40sbcglobal.net

This email sent to cocoa.be...@sbcglobal.net


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Core Data, Garbage Collection and SQL Store

2009-01-30 Thread Kevin Ross

Hi all,
It has recently come up on the list again about a known issue when  
using Core Data + G.C. + SQL NSPersistantDocumentStore.  I have a  
document based application that I am about to release where I have  
been using this exact combination through it's entire development.  I  
have noticed this issue with the hang while saving, but at the time  
I had thought that it was caused by me corrupting the document's  
object graph. Indeed the problem seemed to stop once I had fixed some  
of my App's logic and I haven't seen the issue since.


Me question now is, is it known if there are any particular types of  
models that can cause this hang?  I am using SQL since I will be  
storing one picture and multiple images of floor plans per document as  
per the Core Data BLOBs docs.  My data model is has about 12 entities,  
but will only have a few instances of each object.  I haven't seen  
this issue in quite a while and I was wondering if it might be safe to  
release it with SQL set as the default backing store?


Thank you for any insights you may have into this matter.




Kevin Ross
Feng Shui Software
cocoabeans.heliohost.org



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data, Garbage Collection and SQL Store

2009-01-30 Thread Kevin Ross


On Jan 30, 2009, at 9:37 AM, Sean McBride wrote:


On 1/30/09 9:14 AM, Kevin Ross said:


It has recently come up on the list again about a known issue when
using Core Data + G.C. + SQL NSPersistantDocumentStore.  I have a
document based application that I am about to release where I have
been using this exact combination through it's entire development.  I
have noticed this issue with the hang while saving, but at the time
I had thought that it was caused by me corrupting the document's
object graph. Indeed the problem seemed to stop once I had fixed some
of my App's logic and I haven't seen the issue since.


I think you're getting lucky.  I can certainly still repro this bug.
And my Radar has not come back 'fixed'.

I find it quite bothersome that a bug that causes user data loss is
still unfixed in 10.5.6.  It must be a hard nut to crack.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




If it's not too much trouble are you able to send me your repro project?
I'm wondering why it's not happening with my project anymore.


To jonat...@mugginsoft.com:
I am dirtying the document before each save and it still isn't  
happening.  In certain instances, the MOC's undoManager is cleared  
before saving, but other times it's not (I'm not sure if this matters  
for this instance...).


I am also running 10.5.6 + Xcode 3.1.2.

Thank you all for your comments!

Kevin Ross
Feng Shui Software
cocoabeans.heliohost.org___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data, Garbage Collection and SQL Store

2009-01-30 Thread Kevin Ross



On Jan 30, 2009, at 3:02 PM, Sean McBride wrote:


On 1/30/09 2:49 PM, Kevin Ross said:

If it's not too much trouble are you able to send me your repro  
project?

I'm wondering why it's not happening with my project anymore.


I'm afraid the bug I filed contains not a simple test project, but my
entire (unreleased) application.  I wanted to be sure they fixed my
exact case.

Sorry,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




No problem, thanks anyway Sean!

Kevin Ross
Feng Shui Software
cocoabeans.heliohost.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Dates of the Chinese New Year

2009-01-25 Thread Kevin Ross

Hello everyone,

I see that in the docs that the Chinese calendar is not supported on  
10.4-5.  Does anyone know if one of the other calendars  
(NSBuddhistCalendar or NSJapaneseCalendar maybe?) would be able to  
find the beginning of the Chinese New Year?


Any insights would be much appreciated!



Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dates of the Chinese New Year

2009-01-25 Thread Kevin Ross


On Jan 25, 2009, at 12:12 PM, Nick Zitzmann wrote:



On Jan 25, 2009, at 11:55 AM, Kevin Ross wrote:

I see that in the docs that the Chinese calendar is not supported  
on 10.4-5.  Does anyone know if one of the other calendars  
(NSBuddhistCalendar or NSJapaneseCalendar maybe?) would be able to  
find the beginning of the Chinese New Year?



They won't. The Buddhist and Japanese calendars are pure solar  
calendars, and are identical to the Gregorian calendar, except that  
the epoch is different. The Gregorian calendar, for example, sets  
year 1 to the year in which Jesus was believed to be born in,  
whereas the Buddhist calendar sets year 1 to the Buddha's birth  
year, and the Japanese calendar sets year 1 in any given era to the  
year in which the then-emperor was crowned (which would be January  
7, 1989 for the current emperor). But other than that, everything  
else is the same.


The Chinese calendar is a lunisolar calendar in which months begin  
and end based on the moon's appearance over Beijing, with leap time  
to make up for the ~12 day difference between lunar and solar years.  
There is some stuff in the ICU library that will help you figure out  
the position of the moon, which is also important in the Hebrew and  
Islamic calendars, but from there, it's up to you. There are some  
books on calendrical calculations that you might want to read...


Nick Zitzmann
http://www.chronosnet.com/





Thanks Nick, I was beginning to think that this was going to be more  
complex than I had hoped.  I might just end up finding a large enough  
database of dates for relevant years and just reference that instead  
of calculating them.  At least until I can study up on this lunisolar  
business.


Kevin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: PDFDocument Subclass and Undo Manager Redux

2008-07-14 Thread Kevin Ross
Well after making some tweaks I seem to have it working.  I'm not sure  
if it was something that I did or if the 10.5.4 update could have  
fixed the undo manager bug in PDFView.  Anyway, I've got it working,  
thanks!


- Kevin

On Jul 11, 2008, at 3:31 PM, Kevin Ross wrote:

Hello cocoa-devs!  I'm not sure if I'm heading in the right  
direction here or if I'm running off into the brush...


I have a PDFDocument subclass that has it's own undoManager.  This  
is so it can perform transformations upon itself and undo/redo.  The  
trouble is when I try to integrate it into my NSDocument class.   
I'll try to return the PDF's undoManager like so:


- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window; {
return [(KRPDFDocument *)[pdfView document] undoManager];
}

While this returns an NSUndoManager which != NULL, it doesn't  
actually hook into the responder chain so when I make a change it  
doesn't register in the menu.  Is this because PDFDocument does not  
inherit from NSResponder?


Is the proper way to have the undoManager *in* the PDFDocument  
sublcass?  Or is it better to use the undoManager provided by  
NSDocument?


It seems like I'm missing something that's right in front of my  
nose, but if anyone has some insight out there, please let me know!   
Thanks!



- Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoa.beans%40sbcglobal.net

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


[PDFDocument documentRef] internal method questions.

2008-07-14 Thread Kevin Ross
In my subclassing PDFDocument adventures I wanted to add a method to  
my subclass like so:


- (CGPDFDocumentRef)documentRef;

I realized that it was overriding an internal PDFDocument method that  
I was unaware of.  This actually helps a big performance bottleneck in  
the application because I can use it instead of creating my own docRef  
from scratch each time.  What I'm not sure about though is how safe I  
am using this in my application since it might break on future OS  
updates.  I'm planning on filing an enhancement request since it is  
useful to be able to get a CGPDFDocumentRef directly from a  
PDFDocument object.  How safe am I using this method in my application?



Namasté,

Kevin___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


PDFDocument Subclass and Undo Manager Redux

2008-07-11 Thread Kevin Ross
Hello cocoa-devs!  I'm not sure if I'm heading in the right direction  
here or if I'm running off into the brush...


I have a PDFDocument subclass that has it's own undoManager.  This is  
so it can perform transformations upon itself and undo/redo.  The  
trouble is when I try to integrate it into my NSDocument class.  I'll  
try to return the PDF's undoManager like so:


- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window; {
return [(KRPDFDocument *)[pdfView document] undoManager];
}

While this returns an NSUndoManager which != NULL, it doesn't actually  
hook into the responder chain so when I make a change it doesn't  
register in the menu.  Is this because PDFDocument does not inherit  
from NSResponder?


Is the proper way to have the undoManager *in* the PDFDocument  
sublcass?  Or is it better to use the undoManager provided by  
NSDocument?


It seems like I'm missing something that's right in front of my nose,  
but if anyone has some insight out there, please let me know!  Thanks!



- Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: PDFDocument subclass with an undo manager

2008-07-01 Thread Kevin Ross
That did the trick, thank you for the insight.  It seems so obvious  
after the fact!

Thank  you again very much!

- Kevin



On Jun 30, 2008, at 6:23 PM, Graham Cox wrote:

It won't redo because when it performs the undo, it is calling - 
initWithData: directly, and I take it from this snippet that  
initWithData: isn't recording the undo.


You need to create a wrapper method for initWithData that contains  
the undo recording step, then make that method the target of the  
undo, something like:


- (void)myInitWithData:(NSData*) newData
{
	[[undoManager prepareWithInvocationTarget:self] myInitWithData: 
[self oldData]];

[self initWithData:newData];
}


hth,

cheers, Graham




On 1 Jul 2008, at 9:02 am, Kevin Ross wrote:

Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods  
I have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a  
better way?


Thanks for any pointers and/or suggestions!!

Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


PDFDocument subclass with an undo manager

2008-06-30 Thread Kevin Ross
Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods I  
have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a better  
way?


Thanks for any pointers and/or suggestions!!

Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: PDFDocuments and CGPDFDocuments

2008-05-31 Thread Kevin Ross

Whoops, I sent this yesterday but didn't hit reply-all...

Thanks Joel, I just took a look at the PDFAnnotationEditor example.   
It seems to be doing all of it's transformations in the PDFView  
subclass.  I'm not sure if I am able to do this since I would like to  
perform the impositions by working strictly with the data of the  
PDFDocument.


David's book is fantastic, I'm been using it plus a lot of inspiration  
to get to where I am now.  It has been essential on this journey.


In my naiveté, I had hoped that I could cast between the two with a  
smaller performance penalty than converting PDFDocument - NSData -  
CGPDFDocumentRef.  Needless to say, there has been no headway on that  
front.


I currently have an Initilalizing... document modal window activate  
when I'm initializing the CGPDFDocumentRef so it's not too bad, it  
would just be nice to avoid this behavior completely.


I realize that perhaps this question might be better suited for quartz- 
dev, thank you for your insight!


- Kevin

On May 29, 2008, at 8:52 PM, Joel Norvell wrote:


Kevin,

The PDFAnnotationEditor example program does a lot of this sort of  
thing; have

you looked at it?

Also, any operation you can perform on an NSView also applies to a  
PDFView;

plus you have the additional PDFView protocol.

Other pertinent resources would be Apple's quartz-dev list and David  
Gelphman's

beautiful book, Programming With Quartz.

HTH,
Joel





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoa.beans%40sbcglobal.net

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


PDFDocuments and CGPDFDocuments

2008-05-29 Thread Kevin Ross
Hi everyone, I seem to have run into a little snag recenlty.  I have  
an application that manipulates PDF files (scaling, imposition,  
transforms...).  I am using a PDFView for the interface but performing  
all of the transformations in Quartz.  I find myself shuttling data  
back and forth by using
CGDataProviderCreateWithCFData((CFDataRef)[pdfDocument  
dataRepresentation]

before the transformation and
[[[PDFDocument alloc] initWithData:(NSData *)cgPDFAsMutableData]  
autorelease]

after to display in the PDFView.

I'm getting bottlenecks for larger files in the calls to [document  
dataRepresentation].  I think there has to be either a better way of  
doing this or a way to do it where I will not have to convert  
(PDFDocument *) to CGPDFDocumentRef every time I perform a  
transformation.


Does anyone have any suggestions?   Thanks!

- Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Custom Value Transformer for PDFDocument data

2008-05-10 Thread Kevin Ross
Hello, I'm thinking of implementing a Custom Value Transformer to add  
PDFDocument support to a MangedObject.  I just want to see if I'm on  
the right track or not.  The code below works, I'm just not sure if  
this is the proper way to do this.  Thanks for your feedback.


@implementation PDFDataTransformer

+ (Class)transformedValueClass { return [NSData class]; }

+ (BOOL)allowsReverseTransformation { return YES; }


- (id)transformedValue:(id)value
{
   NSData *pdfDocAsData = nil;

   if (value == nil) return nil;

   // Attempt to get a reasonable value from the
   // value object.
   if ([value respondsToSelector: @selector(dataRepresentation)]) {
   pdfDocAsData = [value dataRepresentation];
   } else {
   [NSException raise: NSInternalInconsistencyException
   format: @Value (%@) does not respond to - 
dataRepresentation.,

 [value class]];
   }

   return [pdfDocAsData autorelease];
}

- (id)reverseTransformedValue:(id)value
{
   PDFDocument *pdfDoc = nil;
pdfDoc = [[PDFDocument alloc] initWithData:value];
return [pdfDoc autorelease];
}

--

My other approach was to add an pdfDoc ivar  property and add this  
code:


- (void) init  { pdfDoc = [[PDFDocument alloc] init]; }
- (void) dealloc { [pdfDoc release]; }

and change - (id)reverseTransformedValue:(id)value   to:
- (id)reverseTransformedValue:(id)value
{
[pdfDoc initWithData:value];
return pdfDoc;
}

Any suggestions?

Thank you all again for you expertise.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: PDFView and Core Data undos

2008-04-13 Thread Kevin Ross
I've been struggling for the past week with the exact same problem.   
Does anyone know of a workaround, or should I just roll my own PDFView  
and PDFThumbnailView?


Thanks for any ideas.

Kevin

On Apr 8, 2008, at 3:41 PM, Antonio Nunes wrote:


On Apr 8, 2008, at 10:19 PM, Justin Hawkwood wrote:

How do I call [myPDFView setDocument:previewPDF] without clearing  
out the undoManager?


I don't think you can. (And if you can, I'd really, really like to  
know :-) I filed a bug report on this  back in Feb. (#5733716).


António


Energy is like a muscle,
it grows stronger through being used.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoa.beans%40sbcglobal.net

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]