src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
changeset 53319 db7b41933563
parent 52251 b43c2aa001a5
child 54875 bcfedddcf4ce
equal deleted inserted replaced
53318:db202823fd94 53319:db7b41933563
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   159 {
   159 {
   160 #ifndef HEADLESS
   160 #ifndef HEADLESS
   161     int len;
   161     int len;
   162     char *stock_id_str = NULL;
   162     char *stock_id_str = NULL;
   163     char *detail_str = NULL;
   163     char *detail_str = NULL;
       
   164     jboolean result = JNI_FALSE;
   164 
   165 
   165     if (stock_id == NULL)
   166     if (stock_id == NULL)
   166     {
   167     {
   167         return JNI_FALSE;
   168         return JNI_FALSE;
   168     }
   169     }
   188             return JNI_FALSE;
   189             return JNI_FALSE;
   189         }
   190         }
   190         (*env)->GetStringUTFRegion(env, detail, 0, len, detail_str);
   191         (*env)->GetStringUTFRegion(env, detail, 0, len, detail_str);
   191     }
   192     }
   192 
   193 
   193     if (!init_method(env, this) ) {
   194     if (init_method(env, this)) {
   194         free(stock_id_str);
   195         result = gtk->get_icon_data(env, widget_type, stock_id_str,
   195         if (detail_str != NULL) {
   196                                     icon_size, text_direction, detail_str,
   196             free(detail_str);
   197                                     icon_upcall_method, this);
   197         }
   198     }
   198         return JNI_FALSE;
       
   199     }
       
   200     jboolean result = gtk->get_icon_data(env, widget_type, stock_id_str,
       
   201                   icon_size, text_direction, detail_str,
       
   202                   icon_upcall_method, this);
       
   203 
       
   204     /* Release the strings we've allocated. */
   199     /* Release the strings we've allocated. */
   205     free(stock_id_str);
   200     free(stock_id_str);
   206     if (detail_str != NULL)
   201     free(detail_str);
   207     {
   202 
   208         free(detail_str);
       
   209     }
       
   210     return result;
   203     return result;
   211 #else /* HEADLESS */
   204 #else /* HEADLESS */
   212     return JNI_FALSE;
   205     return JNI_FALSE;
   213 #endif /* !HEADLESS */
   206 #endif /* !HEADLESS */
   214 }
   207 }