Problem showing images from UISlider

I'm trying to get some images shown responsively as the user slides a slider,  If I set up my image on each call of SliderValueChanging (the selector for control event UIControlEventValueChanged), as below, then I get an error indicating there's an event after I've released it.
    UIImage *btnimg = [UIImage imageNamed:imagefile]; 
    [button setImage:btnimg forState:UIControlStateNormal];
    [btnimg release];
The error occurs while the user is still using the slider and the message is:
[UIImage _isResizable]: message sent to deallocated instance
So I thought I'd store my images until the user has finished using the slider and release them then.  So I build them up in an array in SliderValueChanging as below:
    UIImage *btnimg = [UIImage imageNamed:imagefile]; 
    [button setImage:btnimg forState:UIControlStateNormal];
    // assign into our array for later release...
    if ( self.tmpimages == nil ) {
        //Initialize the array.
        self.tmpimages = [[NSMutableArray alloc] init];
    [self.tmpimages addObject:btnimg];
    [btnimg release];
and then release them in SliderValueChanged (the selector for control event UIControlEventTouchUpInside)
    // tidy up our tmp images from sliding...
    if ( self.tmpimages != nil ) {
        [self.tmpimages removeAllObjects];
        [self.tmpimages release];
        self.tmpimages = nil;
The sliding then works without any problems but I get an error when the sliding is finished indicating I'm trying to release an object which I've already released.
[UIImage release]: message sent to deallocated instance
The error is being generated from the releaseAllObjects call.
What am I doing wrong?  Can I prevent either of these error scenarios so that I get my images to show responsively with the slider without any problems?
Thanks!

Under the Cocoa naming conventions objects returned by convenience methods like:
    UIImage *btnimg = [UIImage imageNamed:imagefile];
are passed you autoreleased. You should not send a release to this object and the errors you're getting reflect this. If you add it to an array this will add to the retain count but you should not release it after adding it to the array - just add it.
The magic words in Cocoa are alloc, copy and new. If you use these words when you create it then you own it. If not assume something else owns it and will do the right thing. If you release something you don't own (or have explicitly retained) you're stepping on the process and you'll get errors like the ones you're getting.
HTH,
=Tod

Similar Messages

  • How can i show images from different folders  in image gallery

    Hi All,
             i have downloaded and executed photo viewer image gallery application.
              in that we r showing images sequentially what we have defined in xml file.
             but i want show images randomly or i want show images from different gallary.
    Can any one help me.
    thanks
    Raghu.

    WaqarLFC7 wrote:
    On Windows:
    Ctrl + click on the songs you want to group - then right click and click get info and it will ask you if you want to get info for multiple items click YES then under album name it whatever you want and them songs will be grouped into 1 album.
    Mac:
    Same procedure but hit SHIFT instead of CTRL.
    Actually, it's right click or ctrl click, same as windows.

  • The monitors of on location CS3 not showing image from Sony FX7

    O.L records OK and plays back but at no time do
    any of the monitors show an image. Was OK in Vista now gone to Windows 7
    Pre Pro CS3 ok on 7 (capture and playback.) Any suggestions please

    Dear Sir, Many many thanks for your very detailed answer everything works just fine. I'm not sure wether I should reply to your answer elsewhere please advise me if this is the case.
    thanks again William sign on name Breezley.
    Date: Mon, 4 Jan 2010 18:44:18 -0700
    From: [email protected]
    To: [email protected]
    Subject: the monitors of on location CS3 not showing image from Sony FX7
    Breezley,
    OnLocation CS3 used Direct Draw to create the video window.  In Vista, you may have noticed that OnLocation CS3 would disable 'Aero' themed desktops as they did not support Direct Draw.  Windows 7 does not have this functionality, so you must disable the Aero theme manually to see the video in OnLocation CS3.
    To do this, right click on open desktop and choose Personalize.
    This will display available Themes.
    Scroll down to the 'Basic and High Contrast Themes'.
    Choose any one of the basic or high contrast themes.
    Restart OnLocation CS3.
    This should bring your video back into view.
    >

  • Problem loading image from jar file referenced by jar file

    First, I searched this one and no, I didn't find an answer. Loading images from jar files has been pretty much done to death but my problem is different. Please read on.
    I have my application, a straight up executable running from Eclipse. It uses a jar file, call it JarA. JarA launches a GUI that is located in another jar file. Call it JarB. To recap:
    My application calls JarA -> JarA loads classes from JarB -> JarB looks for images to place in a GUI it wants to show on the screen
    When JarB goes to load an image the following happens:
    java.lang.NullPointerException
         at sun.misc.URLClassPath$3.run(URLClassPath.java:316)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:313)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:290)
         at sun.misc.URLClassPath.findResource(URLClassPath.java:141)
         at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
         at java.lang.ClassLoader.getResource(ClassLoader.java:977)
         at org.cubrc.gmshell.gui.MainWin.preInit(MainWin.java:152)
         at org.cubrc.gmshell.gui.MainWin.<init>(MainWin.java:135)
    The code from JarB that loads the image looks like this:
              URL[] oSearch = {Main.class.getResource("images/")};
              URLClassLoader oLoader = new URLClassLoader(oSearch);
              imgIcon = new ImageIcon(oLoader.getResource("icon.gif"));
              imgMatchRunning = new ImageIcon(oLoader.getResource("gears.gif"));
              imgMatchStill = new ImageIcon(oLoader.getResource("gears-still.gif"));
              imgMagnify = new ImageIcon(oLoader.getResource("magnify.gif"));This looks right to me and JarB certainly has an images directory with those files. But I'm in hell right now because I don't know where to place the images to make this work or if you can even attempt to load images with a dependency chain like this.
    Any help very appreciated!

    Have you tried to move your image-files out of the jar file and place them in the sam folder as the jar-file? I think that would help.
    When you try to load the image-file you get the NullPointerException because the program tries to read a file it can't find. Remember that a jar file IS a file and not a directory.
    If you want to read somthing inside the jar-file you need to encode it first.
    Have you tried to read the jar-file with winRar. It makes it easy to add and remove files in your jar-file.

  • Problems showing image file using ShowProperty servlet

    Hi there,
    I´m having problems trying to show an image from the repository using ShowProperty servlet. My node is of type image and my repository is a Library Services enabled repository. When I try to show my node´s binary property "file" the servlet returns the following message "A Primary Property is not defined for Node:...". But checking the node´s ObjectClass I can see that the file property is defined as a primary property. Can somebody help me on this ?
    tks,
    George Earp

    Hi Anders,
    first thanks for trying to help me. Answering your questions in order: I certified myself that the node was saved and checked in using the Portal Administration site. I looked in debug mode and the Node is loaded correctly but the properties aren´t there. I have some more information for you. I decompiled the servlets (ShowBinaryServlet and ShowPropertyServlet). The news are that ShowBinaryServlet is a ShowPropertyServlet´s child that has no additional implementation. Other relevant information is that ShowPropertyServlet implementation gets the Node throught NodeOps object and try to get the binary property with it. But, reading the API and doing tests I could only get my Node properties throught a Virtual Node (see NodeOps Interface part of the API). That´s because my Repository is a managed repository. So, the servlets can´t find the bynary property in my Node because it isn´t there... It is under a VirtualNode... Am I right ? If that´s true I believe I´ll have to implement a solution myself... Too sad... :(
    Message was edited by eduardo.earp at Jan 25, 2005 9:21 AM

  • Problem Displaying image from blob

    Hi all,
    I m using,
    Database : 10g Rel 2
    Frontend : DevSuite 10g
    OS : WinXp
    Browser : IE 6
    Problem : In my forms i m displaying images from blob column but some of the images are not displayed. I have tried with all image formats available in combination with all available display quality but no luck. What could be the reason for it and how do i solve it?
    Can anyone help me plz?
    Thnx in advance.
    Imtiaz

    Hello,
    It is very difficult for us to "guess" what images you can read and what others you cannot.
    Maybe you could provide more information on images that are not displayed ?
    What is their native format ?
    Francois

  • Showing image from database

    Hi,
    can anyone tell/give me an example/tutorial of how to retrieve the image from the database into forms? so i have a table names EMPLOYEES for example, and i added a clob type column, named "photo". in forms, when i show the informations for each person, i wanna already retrieve the image, somehow. how can i do this? a small example i think will be persuasive :)
    Thanks!
    Regards

    <p>To populate the Image Item you have to use the Webutil Client_Read_Image_File() built-in.</p>
    Francois

  • Help........Show image from database

    Hi,
    I am stuck at one point. I have to show image stored in the database on the browser. I am able to fetch the image and show it after storing it in one .gif file. But what I want it is : I don't want to store the fetched image in to a .gif file instead I would like to show the image on the fly after fetching it from the database.
    The reason I need it this way is...If I store it as .gif before showing, after showing the file the file still will be present in the disk, which after sometime will go beyond the limit.
    If at all it is not possible to show it on the fly, then I would like to know if there is any "SESSION ON END" kind of even available in Java so that I can clean up the image when user exits the browser!!!
    Please reply as soon as possible.

    For the first part of your question: If the image is the
    only thing you are showing on the browser.. then
    you can stream the data (I think I never tried with
    gifs)
    try {
         response.setContentType("image/gif");
         ServletOutputStream outf =
    response.getOutputStream();
    // Print the steamed image data to this
    outf
    outf.flush();
         } catch (Exception e){
              System.out.println("Exception Caught"+e.toString());
    }

  • Problem loading images from a return value of a function

    hello, I write because I uin problem in loading images from a return value of a function.
    I created a database with a field "image" of type string, where I put the physical address of the image. I have written like this: {__DIR__ }foto.jpg
    Place the code, so you understand better
    function imageViewImage(): javafx.scene.image.Image {
    connetti();
    lass.forName(driverName);
    con = DriverManager.getConnection(url,user,"");
    stmt = con.createStatement();
    var richiesta:String = "SELECT image from viaggio WHERE id_viaggio=7";
    rs1 = stmt.executeQuery(richiesta);
    var result :String;
    rs1.next();
    risultato = rs1.getString("image");
    JOptionPane.showMessageDialog(null, result);
    var imagez = Image{
    url:"{result}";
    return imagez;
    The image is in the source code package
    First I connect to the database, run the query and I take the contents of the image.
    Can anyone help me?
    Is right to put in the database {__DIR__} foto.jpg or do I put only foto.jpg?

    Hello unkus_nob,
    I would rather suggest you to save only filename of that image like "foto.jpg" in database. And just concat it with the String variable containing "{__DIR__}".
    Actually the javafx compiler converts the {__DIR__} to the existing class directory path something like : "jar:file:/..../".
    var currentDir ="{__DIR__}";
    risultato = "{currentDir}{rs1.getString("immagine"})"; 
    var image = Image{
        url:risultato
    return image;--NARAYAN G.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problem downloading images from camera chip

    I have attempted to download images from my camera chip on several occasions into Lightroom 5.3 and I get a statement which says "Some import operations were not performed-files are not being read (281).  How do I get images imported?  This is the first time I have encountered this problem.  Suggestions?

    You might be better asking in the Lightroom forum
    http://forums.adobe.com/community/lightroom
    But there a few threads and hits from other sites if you lok round
    http://forums.adobe.com/message/5474641

  • Problem importing images from CCO to WLSE 2.13.1

    Hello,
    I recently upgraded my WLSE Express from 2.13 to 2.13.1.
    Now I have a problem with importing firmware images from cisco.com. Every time I get the following error:
    Image download started for device type: BR1310 version: 12.3.11-JA1
    Device type: BR1310, version: 12.3.11-JA1. Image import failed. Imported file is not a valid image.
    Is there any workaround other then import it manually?
    Thanks,
    Peter

    Most likely due to CSCee37875. Workaround is to use Import from Desktop instead, after downloading the image from CCO outside of WLSE.

  • "Problem downloading image" from iPhone

    When I connect my iPhone and open iphoto, it lists as "iPad" and when I try to import photos, it says that it cannot because there is a "Problem downloading image." I get an "Import error" when I try importing via Image Capture. I actually removed all the photos from my iPhone, but the same problem occurs. Note: When connected and the preview comes up of the pictures that can be imported, they're all blank (i.e., black "photos" - can't see any preview).
    Also restored iPhone, but the same problem occurs.
    Can anyone help?

    Just by way of update, a camera appears called "iPad" even when I have no devices connected. Reinstalled iPhoto and still have same problem. Also deleted iPhoto .plist files but still have same problem. Thanks.

  • Problem taking image from PS back to LR

    When I send an image from a LR collection to CS3 (select "edit in>adobe photoshop CS3" by right clicking), edit it, then go to save it either LR or CS3 is sometimes saving both the RAW file used and the edited tif in my original folder, not the collection I originally had the file in.  How do I get the edited and RAW file to stay in the collection where it started?
    Just tried again and now I can't find the tiff at all.... this is driving me insane.....

    As you suggested I unflagged the images in the collection. I then took an image to ps to edit and brought it back; both the RAW and the tiff were removed from the parent collection and moved back to the folder.
    I wasnt suggesting you remove the flags from the images in the collection. I was suggesting you turn off any Filters that may be preventing you from seeing any images that dont match the Filter.
    For example, lets say you have 10 images in a collection and 5 of them have a Pick Flag. If you Filter to show only Picks then you will see only five images even though the collection actually contains ten.
    both the RAW and the tiff were removed from the parent collection and moved back to the folder.   After that happened I unflagged all the images in the folder.
    Also, just to clarify, an image or images can be removed from a collection but they are not moved back to the Folder. They are ALWAYS in the folder even if they are in a collection. Its not an either / or proposition.
    Can you verify that the collection is:
    1. NOT a Smart Collection
    2. Has no Filtering applied
    If so, I would like to suggest you go to Preferences > Catalog Settings > Relaunch and Optimize. Then see if you can repeat the behaviour or if you get "correct" results.
    Failing that I would suggest a new catalog as a test to be deleted. Import a dozen images and repeat the Flagging/Collection/Editing procedure to see if you get the "correct" results. Unless I am about to learn something new, there is  no preference left unchecked here and no, one should not have to remove Flags from anywhere in order for the derivative file to appear next to the original in a collection.

  • Problem creating  image from a data vector

    Hello i have a problem in this aplication.
    I get a image from a web cam. I want to put the original image in a file and the negative image in another file (in this example is not the negative image, is just a white image). The problem is when i use setData method. The image become black. If I use setFormat method the new image is the original image.
    Here is the code with problems:
    imageBuffer = frameGrabbingControl.grabFrame();
    theData = new int[dataLength];
    theData = (int[]) imageBuffer.getData();
    for (int y = 0; y < videoHeight - imageScanSkip; y+=imageScanSkip) {
    for (int x = 1; x < videoWidth - imageScanSkip; x+=imageScanSkip)
    theData[y*videoWidth+x]=Integer.parseInt("FFFFFF",16);
    Buffer b1=new Buffer(); //This is the new buffer in which i want to put the new pic
    b1.setData(theData);
    //here i create the 2 files frst from the original buffer and second from the new buffer b1
    Image img = (new BufferToImage((VideoFormat)imageBuffer.getFormat()).createImage(imageBuffer));
    Image img1 = (new BufferToImage((VideoFormat)b1.getFormat()).createImage(b1));
    BufferedImage buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
    BufferedImage buffImg1 = new BufferedImage(320,240, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = buffImg.createGraphics();
    Graphics2D g1 = buffImg1.createGraphics();
    g.drawImage(img, null, null);
    g1.drawImage(img1, null, null);
    try{
    ImageIO.write(buffImg, "jpg", new File("c:\\webcam.jpg"));
    ImageIO.write(buffImg1, "jpg", new File("c:\\webcam1.jpg"));
    catch (Exception e){}
    the webcam1.jpg file is black(it should be white).
    If i put "b1.setFormat(imageBuffer.getFormat());" the webcam1.jpg will be same the file as webcam.jpg

    Hello i have a problem in this aplication.
    I get a image from a web cam. I want to put the original image in a file and the negative image in another file (in this example is not the negative image, is just a white image). The problem is when i use setData method. The image become black. If I use setFormat method the new image is the original image.
    Here is the code with problems:
    imageBuffer = frameGrabbingControl.grabFrame();
    theData = new int[dataLength];
    theData = (int[]) imageBuffer.getData();
    for (int y = 0; y < videoHeight - imageScanSkip; y+=imageScanSkip) {
    for (int x = 1; x < videoWidth - imageScanSkip; x+=imageScanSkip)
    theData[y*videoWidth+x]=Integer.parseInt("FFFFFF",16);
    Buffer b1=new Buffer(); //This is the new buffer in which i want to put the new pic
    b1.setData(theData);
    //here i create the 2 files frst from the original buffer and second from the new buffer b1
    Image img = (new BufferToImage((VideoFormat)imageBuffer.getFormat()).createImage(imageBuffer));
    Image img1 = (new BufferToImage((VideoFormat)b1.getFormat()).createImage(b1));
    BufferedImage buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
    BufferedImage buffImg1 = new BufferedImage(320,240, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = buffImg.createGraphics();
    Graphics2D g1 = buffImg1.createGraphics();
    g.drawImage(img, null, null);
    g1.drawImage(img1, null, null);
    try{
    ImageIO.write(buffImg, "jpg", new File("c:\\webcam.jpg"));
    ImageIO.write(buffImg1, "jpg", new File("c:\\webcam1.jpg"));
    catch (Exception e){}
    the webcam1.jpg file is black(it should be white).
    If i put "b1.setFormat(imageBuffer.getFormat());" the webcam1.jpg will be same the file as webcam.jpg

  • Problems exporting images from LTRM3

    last week no problems exporting images at all
    come yesterday I get a screen saying ' An unexpected error occurred. This photo was not rendered. ( 1) '
    this seems to occur for all images I have in LTRM
    any helpful heros out there ?!!

    Hi Geoff
    windows 7 buisness ed.
    the images were improted from my hard drive as RAW - processes - and am trying to export to a different file on HD as JPEGS
    strange as this is a workflow I have used numerous times and it has been fine until now
    I cant think of anything that I have delib. changed in LTRM in the last few days either
    appreciate your efforts
    Gus

Maybe you are looking for