Problems with ResourceFork Class 
Author Message
 Problems with ResourceFork Class

I have this problem in that when ever I open a ResourceFork on the System
file, the Mac crashes on exit of the program.

Dim lResource as ResourceFork
Dim count as Integer

lResource = GetFolderItem(":System Folder:System").OpenResourceFork
count = lResource.TypeCount
msgBox str(count)
lResource.Close

The above gets the number of resources in the system resource fork and that
part works.
It's just when the application terminates, I get a system error and have to
switch off the Mac to recover.
It's running System 8.6 on an iMac.

Basically, I want to be able to get system info like OS version, Memory used
etc.

Does anyone know what is going on?

Regards, and thanks for any help.

Anthony



Sat, 07 Dec 2002 03:00:00 GMT  
 Problems with ResourceFork Class

Quote:

> I have this problem in that when ever I open a ResourceFork on the System
> file, the Mac crashes on exit of the program.

Ack!  I should think so.  You should never open the resource fork of
the system file.  Doing so is exceedingly dangerous.  Why do you
believe you need to do that?

--
,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Sat, 07 Dec 2002 03:00:00 GMT  
 Problems with ResourceFork Class

Quote:

> Ack!  I should think so.  You should never open the resource fork of
> the system file.  Doing so is exceedingly dangerous.  Why do you
> believe you need to do that?

Joe, the error is somewhere else, and I reported that bug over one year
ago and others kept on reminding you guys about it:

If RB opens a rsrc file that was already open, it does not create its
own file ref, but _shares_ the open file refnum. Then, when the RB app
quits, it _closes_ the file although it did not own it. That's the error
and that's what's causing the crash. Some error happens when someone
opens the own app's rsrc fork (yes, I know you could use the App's
property for that, but it would still happen if someone scans all a
volume's files, opens their rsrc forks and then also gets to its own
rsrc fork without knowing that this is its own, where it would have then
to use a different way to open it!)

So, just get into your bug database, find not only the bug description,
but also the solution that I provided (it took me over an our to
disassemble RB's and and then to provide the "fix" code), and just
implement it, dammit! Please.

If you can't find the code, I can try to dig it out on my side again.
It's pretty straight forward and just does what Apple's tech docs
explain anyway: if you open a rsrc that's already open with write
permission, you have to re-open it with read-only perm in order to get
your own file refnum to it; alternatively, save the "was opened by
someone else already" state and refrain from closing it yourself at the
end!

Thomas

--
Thomas Tempelmann

<mailto:tom$tempel.org>



Sat, 07 Dec 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. FolderItem.ResourceFork resfNum How ?

2. Writing to the resourcefork

3. dragItems and resourceForks

4. ResourceFork

5. Resourceforks

6. Resourcefork help

7. How do create a File and add ResourceForks

8. Using App.ResourceFork HELP!

9. Problem with calling instance of one class from another class

10. class of a class problem

11. Problems adding iVar to ListView Column class

12. problem choosing superclass in Create Class dialog

 

 
Powered by phpBB® Forum Software