8204895: Better icon support
authorserb
Thu, 16 Aug 2018 10:22:25 -0700
changeset 53319 db7b41933563
parent 53318 db202823fd94
child 53320 42037e059f2c
8204895: Better icon support Reviewed-by: prr, mschoene, aghaisas, rhalade
src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c	Wed Aug 15 09:36:32 2018 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c	Thu Aug 16 10:22:25 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -161,6 +161,7 @@
     int len;
     char *stock_id_str = NULL;
     char *detail_str = NULL;
+    jboolean result = JNI_FALSE;
 
     if (stock_id == NULL)
     {
@@ -190,23 +191,15 @@
         (*env)->GetStringUTFRegion(env, detail, 0, len, detail_str);
     }
 
-    if (!init_method(env, this) ) {
-        free(stock_id_str);
-        if (detail_str != NULL) {
-            free(detail_str);
-        }
-        return JNI_FALSE;
+    if (init_method(env, this)) {
+        result = gtk->get_icon_data(env, widget_type, stock_id_str,
+                                    icon_size, text_direction, detail_str,
+                                    icon_upcall_method, this);
     }
-    jboolean result = gtk->get_icon_data(env, widget_type, stock_id_str,
-                  icon_size, text_direction, detail_str,
-                  icon_upcall_method, this);
-
     /* Release the strings we've allocated. */
     free(stock_id_str);
-    if (detail_str != NULL)
-    {
-        free(detail_str);
-    }
+    free(detail_str);
+
     return result;
 #else /* HEADLESS */
     return JNI_FALSE;