NSImage from bitmap - then delete bitmap

2016-07-21 Thread Trygve Inda
I create an NSBitmapImageRep:

[[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:pixelSize.width
pixelsHigh:pixelSize.height
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bitmapFormat:NSAlphaFirstBitmapFormat
bytesPerRow:pixelSize.width * 4
bitsPerPixel:32]

I then get the address by sending a "bitmapData" message to the object

After filling it with image data, I call:

NSImage* image =
[[NSImage alloc] initWithData:[myImageRep TIFFRepresentation]];

So now I have an NSImage. What happens if I delete/release myImageRep (my
NSBitmapImageRep)?

Has the call to NSImage copied my pixels so that they are self-contained
within the NSImage?

If not, how can I do so? I am using a single NSBitmapImageRep and trying to
reuse it while making many different NSImage objects, each with their own
data.

Thanks,

Trygve



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Graham Cox

> On 22 Jul 2016, at 9:22 AM, Uli Kusterer  wrote:
> 
> On 21 Jul 2016, at 17:20, Graham Cox  wrote:
>> One of my apps uses NSTask to wrap a command line utility that is embedded 
>> in the same app’s resources. This utility writes files to disk - I have no 
>> knowledge of which APIs it uses to do this. If the task has ended (and I can 
>> see that the actual instance of the running command line tool has 
>> disappeared from my process tasks in Activity Monitor), and I send the file 
>> to the trash, I can’t delete it (empty trash) until the app as a whole is 
>> quit - I get the message that the file is still in use.
>> 
>> I’ve checked that I’m closing down the NSTask properly, as far as I can see.
>> 
>> Is this the expected behaviour?
> 
> Are you reading all the data from the task (i.e. its standardOutput, not the 
> file) before you close it? AFAIR that's a prerequisite for it to properly 
> close.



I have a NSPipe attached to stdout. I’m not currently doing anything when the 
task termination handler is invoked to read from that, but it’s easy enough to 
do.

However, on further investigation, the problem doesn’t seem to be that.

Using lsof, I discovered that the process that was keeping the file open was 
indeed the command line tool I’m running with NSTask. But what was weird is 
that the processes that were keeping the file were running as a child process 
of Dock, not of my app, and were still running. Other instances of the process 
were running correctly as a child process of my app, and they don’t exhibit the 
problem, and of course go away when my app quits.

So what would cause a NSTask I create in my app to make the process it launches 
a child of Dock, not of my app?

—Graham



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread じょいすじょん

> On 22 Jul 2016, at 8:22, Uli Kusterer  wrote:
> 
> On 21 Jul 2016, at 17:20, Graham Cox  wrote:
>> One of my apps uses NSTask to wrap a command line utility that is embedded 
>> in the same app’s resources. This utility writes files to disk - I have no 
>> knowledge of which APIs it uses to do this. If the task has ended (and I can 
>> see that the actual instance of the running command line tool has 
>> disappeared from my process tasks in Activity Monitor), and I send the file 
>> to the trash, I can’t delete it (empty trash) until the app as a whole is 
>> quit - I get the message that the file is still in use.
>> 
>> I’ve checked that I’m closing down the NSTask properly, as far as I can see.
>> 
>> Is this the expected behaviour?
> 
> Are you reading all the data from the task (i.e. its standardOutput, not the 
> file) before you close it? AFAIR that's a prerequisite for it to properly 
> close.
> 
If that fixes it and it's not documented, please file a bug against the docs.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Uli Kusterer
On 21 Jul 2016, at 17:20, Graham Cox  wrote:
> One of my apps uses NSTask to wrap a command line utility that is embedded in 
> the same app’s resources. This utility writes files to disk - I have no 
> knowledge of which APIs it uses to do this. If the task has ended (and I can 
> see that the actual instance of the running command line tool has disappeared 
> from my process tasks in Activity Monitor), and I send the file to the trash, 
> I can’t delete it (empty trash) until the app as a whole is quit - I get the 
> message that the file is still in use.
> 
> I’ve checked that I’m closing down the NSTask properly, as far as I can see.
> 
> Is this the expected behaviour?

Are you reading all the data from the task (i.e. its standardOutput, not the 
file) before you close it? AFAIR that's a prerequisite for it to properly close.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Daniel Stenmark
Do you have any NSPipes or NSFileHandles set on the NSTask’s I/O channels? 
(standardOutput, standardError, and standardInput)

Dan

> On Jul 21, 2016, at 8:20 AM, Graham Cox  wrote:
> 
> One of my apps uses NSTask to wrap a command line utility that is embedded in 
> the same app’s resources. This utility writes files to disk - I have no 
> knowledge of which APIs it uses to do this. If the task has ended (and I can 
> see that the actual instance of the running command line tool has disappeared 
> from my process tasks in Activity Monitor), and I send the file to the trash, 
> I can’t delete it (empty trash) until the app as a whole is quit - I get the 
> message that the file is still in use.
> 
> I’ve checked that I’m closing down the NSTask properly, as far as I can see.
> 
> Is this the expected behaviour?
> 
> —Graham
> 
> 
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/dstenmark%40opentable.com
> 
> This email sent to dstenm...@opentable.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Jens Alfke
That’s strange. I would use the `lsof` tool to figure out which process has 
that file open. You can also use `fs_usage` while the tool is running to 
monitor all the filesystem activity on that file.

—Jens
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

unexpected NSTextViewDelegate behavior

2016-07-21 Thread David Young
Sometimes my implementation of NSTextViewDelegate method
textView:shouldChangeTextInRanges:replacementStrings: is called with
different arguments than I expect.  Maybe I have overlooked some
way to get the desired behavior?

Here is an example of the behavior.  I select a character, the 'w'
in the sentence below---I will use [] to indicate selections:

All [w]ork and no play makes Jack a dull boy.

Next, I Command-select another character, the 'b':

All [w]ork and no play makes Jack a dull [b]oy.

Then I tap the Delete key.  I expect for the AppKit to call my
textView:shouldChangeTextInRanges:replacementStrings: method once with
ranges [rangeOfW, rangeOfB] and replacementStrings ["", ""]. Instead,
textView:shouldChangeTextInRanges:replacementStrings: is called twice,
once with [rangeOfW] and [""], and a second time with [rangeOfB] and
[""].

For my purposes, it is desirable for shouldChangeTextInRanges: to
see all of the ranges affected by a single editing command, such as
deleteBackward(), at once.  Is there some way to select the behavior
that I expect?

Dave

-- 
David Young //\ Trestle Technology Consulting
(217) 721-9981  Urbana, IL   http://trestle.tech/
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Graham Cox
One of my apps uses NSTask to wrap a command line utility that is embedded in 
the same app’s resources. This utility writes files to disk - I have no 
knowledge of which APIs it uses to do this. If the task has ended (and I can 
see that the actual instance of the running command line tool has disappeared 
from my process tasks in Activity Monitor), and I send the file to the trash, I 
can’t delete it (empty trash) until the app as a whole is quit - I get the 
message that the file is still in use.

I’ve checked that I’m closing down the NSTask properly, as far as I can see.

Is this the expected behaviour?

—Graham



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Do Debug Apps Expire on iOS?

2016-07-21 Thread Eric E. Dolecki
File a Radar for that. I agree that would be nice, but normally a year
should be plenty when you're getting debug help from other users.

On Thu, Jul 21, 2016 at 10:15 AM Steve Bird  wrote:

>
> > On Jul 21, 2016, at 10:05 AM, Eric E. Dolecki 
> wrote:
> >
> > I believe that debug apps built directly to hardware have a shelf life of
> > one year. At least they did.
>
> I don’t know, but I would hope that they would pop up some notice like
> “This app has expired. Contact the developer for the current version”.
>
> That would seem to be the polite thing to do, rather than driving off into
> the ditch and staying there.
> 
> Steve Bird
> Culverson Software - Elegant software that is a pleasure to use.
> www.Culverson.com (toll free) 1-877-676-8175
>
>
>
>
>
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Do Debug Apps Expire on iOS?

2016-07-21 Thread Steve Bird

> On Jul 21, 2016, at 10:05 AM, Eric E. Dolecki  wrote:
> 
> I believe that debug apps built directly to hardware have a shelf life of
> one year. At least they did. 

I don’t know, but I would hope that they would pop up some notice like “This 
app has expired. Contact the developer for the current version”.

That would seem to be the polite thing to do, rather than driving off into the 
ditch and staying there.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175





___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Do Debug Apps Expire on iOS?

2016-07-21 Thread Eric E. Dolecki
I believe that debug apps built directly to hardware have a shelf life of
one year. At least they did. It sounds like you have a problem with your
application (bug) that you should track down before releasing to the store.

Trying looking at the crash log(s) for your application from your device
and that should tell you what's going on.

Eric

On Thu, Jul 21, 2016 at 9:42 AM Charles Jenkins  wrote:

> I have an app (written in Swift) that’s nearly ready to submit to the app
> store. I just need to get better background music. But it seems that every
> few weeks, it stops launching on my iPhone. It seems whenever I want to
> show it off, it won’t start. It dies after the launch screen appears.
>
> Then when I go back home and hook up my phone to my computer and use Xcode
> to debug and launch to see what happens, the app launches without incident
> and works fine. Then it will run normally for some weeks, despite reboots
> and other events that would cause it to relaunch.
>
> So I see two possibilities:
>
> 1. Debug versions expire, iOS will not let you keep using them for months
> or years, and there is no problem.
>
> 2. I have a serious bug that will make users mad, so I need to find out
> what is happening despite the fact that it NEVER happens when I have Xcode
> hooked up and could get a crash report.
>
> Can anyone tell me how to pursue this? What do you do if a debug version of
> an app only ever crashes when you are not running in the debugger?
>
> --
>
> Charles
> ___
>
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>
> This email sent to edole...@gmail.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Do Debug Apps Expire on iOS?

2016-07-21 Thread Charles Jenkins
I have an app (written in Swift) that’s nearly ready to submit to the app
store. I just need to get better background music. But it seems that every
few weeks, it stops launching on my iPhone. It seems whenever I want to
show it off, it won’t start. It dies after the launch screen appears.

Then when I go back home and hook up my phone to my computer and use Xcode
to debug and launch to see what happens, the app launches without incident
and works fine. Then it will run normally for some weeks, despite reboots
and other events that would cause it to relaunch.

So I see two possibilities:

1. Debug versions expire, iOS will not let you keep using them for months
or years, and there is no problem.

2. I have a serious bug that will make users mad, so I need to find out
what is happening despite the fact that it NEVER happens when I have Xcode
hooked up and could get a crash report.

Can anyone tell me how to pursue this? What do you do if a debug version of
an app only ever crashes when you are not running in the debugger?

-- 

Charles
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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