Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:43:54+00:00 2026-05-24T07:43:54+00:00

I’ve implemented the selector alertDidEnd:returnCode:contextInfo: . The last parameter, contextInfo, is a void pointer.

  • 0

I’ve implemented the selector alertDidEnd:returnCode:contextInfo:. The last parameter, contextInfo, is a void pointer. Before calling the method I put the pointer together as follows.

# in windowShouldClose
p = Pointer.new(:boolean)
p.assign(true)

Then I call the method, and inside its body have the following:

# in alertDidEnd
puts p[0] # => a number like 245
puts p.cast!('B')[0] # => false (rather than true)

What am I doing wrong? Is this because the calling method (windowShouldClose) finishes in its own thread before this selector has a chance (just guessing)?

Or should I be creating the pointer as an object pointer?

# make a pointer to an object and assign to it the instance of TrueClass
p = Pointer.new(:id)
p.assign(true)

I’ve read what the O’reilly Macruby Book has to say about this.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:43:54+00:00Added an answer on May 24, 2026 at 7:43 am

    The most likely reason is that nothing is retaining this object so it gets garbage collected. If you create an object and implement its finalize method and put a puts in there, you will be able to see that this is the case.

    Try tracking your state in the controller that is creating the sheet, and passing a pointer to the controller as the contextInfo. If this state is mediating concurrent interactions between ui elements, it is likely the controller that is responsible for all the elements needs to track it anyway. Of course, it is probably then easier to not pass a contextInfo and using which callback you give the sheet to keep track of what conditions it was called under.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a bunch of posts stored in text files formatted in yaml/textile (from
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.