Codenameone generated IOS 8 App crash

1

I have a problem with a codenameone generated IOS application. The application has two multibuttons. On clicking a button the application crash. The application does not always crash on the first click, but eventually does crash if pressed a couple of times.

The Application

package org.tradeswitch.mobile;

import com.codename1.components.MultiButton;
import com.codename1.db.Cursor;
import com.codename1.db.Database;
import com.codename1.db.Row;
import com.codename1.ui.Container;
import com.codename1.ui.Dialog;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.SideMenuBar;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import java.io.IOException;

public class MyApplication implements ActionListener
{
    private Form current;
    private Resources theme;

    public void init(Object context)
    {
        try {
            theme = Resources.openLayered("/theme");
            TUIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void start()
    {
        if (current != null) {
            current.show();
            return;
        }

        showScreen();
    }//start

    private void showScreen()
    {
        UIManager.getInstance().getLookAndFeel().setMenuBarClass(SideMenuBar.class);
        Form hi = new Form("Hi World");

        Container vBorderContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        vBorderContainer.setScrollVisible(true);
        vBorderContainer.setScrollableY(true);

        vBorderContainer.addPullToRefresh(new Runnable()
        {
            public void run()
            {
                Dialog.show("Debug", "addPullToRefresh()", "Ok", null);
            }
        });

        try {
            Database db = Display.getInstance().openOrCreate("TSMOBILE");
            db.execute("drop table if exists SCREENS");
            db.execute("create table if not exists SCREENS(SCR_ID NUMERIC, SCR_NAME VARCHAR(50), SCR_FLAGS NUMERIC, SCR_SERVICE VARCHAR(50))");
            db.execute("insert into SCREENS(SCR_ID, SCR_NAME, SCR_FLAGS, SCR_SERVICE) values(?, ?, ?, ?)",new Object[]{"1", "Test 1", "0", "Service 1"});
            db.execute("insert into SCREENS(SCR_ID, SCR_NAME, SCR_FLAGS, SCR_SERVICE) values(?, ?, ?, ?)",new Object[]{"2", "Test 2", "0", "Service 2"});

            Cursor vScreens = db.executeQuery("select SCR_ID, SCR_NAME, SCR_FLAGS from SCREENS");
            while (vScreens.next()) {
                Row vRow = vScreens.getRow();

                int vId = vRow.getInteger(0);
                String vName = vRow.getString(1);
                int vFlags = vRow.getInteger(2);

                MultiButton vBtn = new MultiButton();
                vBtn.addActionListener(this);

                vBtn.setTextLine1(vName);
                //vBtn.setIcon(theme.getImage("icon.png"));
                //vBtn.setEmblem(theme.getImage("embleem.png"));
                vBorderContainer.addComponent(vBtn);
            }//while
        }//try
        catch (IOException ex) {

        }//catch
        hi.setLayout(new BorderLayout());
        hi.addComponent(BorderLayout.CENTER, vBorderContainer);
        hi.show();
    }

    public void stop()
    {
        current = Display.getInstance().getCurrent();
    }

    public void destroy()
    {
    }

    public void actionPerformed(ActionEvent evt)
    {
        Dialog.show("Debug", "actionPerformed()", "Ok", null);
    }
}

Crash Log

Incident Identifier: 5119BFFE-AA2B-40A9-9146-78183D5BC509
CrashReporter Key:   5c4af4c9a0a9084fc90fd6203262ad6b8204ecbc
Hardware Model:      iPhone6,2
Process:             MyApplication [36967]
Path:                /private/var/mobile/Containers/Bundle/Application/E0A2F5D7-A083-4C38-8484-E862758CEF94/MyApplication.app/MyApplication
Identifier:          org.tradeswitch.mobile
Version:             1.0 (1.0)
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2015-02-15 20:27:47.156 +0200
Launch Time:         2015-02-15 20:27:44.599 +0200
OS Version:          iOS 8.1.3 (12B466)
Report Version:      105

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  2

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x340714f0 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x340712e5 mach_msg + 37
2   CoreFoundation                  0x2621d317 __CFRunLoopServiceMachPort + 143
3   CoreFoundation                  0x2621b8bd __CFRunLoopRun + 1013
4   CoreFoundation                  0x261693bd CFRunLoopRunSpecific + 473
5   CoreFoundation                  0x261691cf CFRunLoopRunInMode + 103
6   GraphicsServices                0x2d5270a5 GSEventRunModal + 133
7   UIKit                           0x297777ad UIApplicationMain + 1437
8   MyApplication                   0x00457ebb 0x98000 + 3931835
9   MyApplication                   0x000e35d7 0x98000 + 308695
10  MyApplication                   0x00233a67 0x98000 + 1686119
11  MyApplication                   0x004ded5b 0x98000 + 4484443
12  MyApplication                   0x004ded9f 0x98000 + 4484511
13  libdyld.dylib                   0x33fbeaad start + 1

Thread 1:
0   libsystem_kernel.dylib          0x34084b38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x341013f5 _pthread_cond_wait + 517
2   libsystem_pthread.dylib         0x34102319 pthread_cond_timedwait + 41
3   MyApplication                   0x004d970f 0x98000 + 4462351
4   MyApplication                   0x0047c09d 0x98000 + 4079773
5   MyApplication                   0x00491a31 0x98000 + 4168241
6   MyApplication                   0x00492369 0x98000 + 4170601
7   MyApplication                   0x004d9bd9 0x98000 + 4463577
8   libsystem_pthread.dylib         0x34101e91 _pthread_body + 137
9   libsystem_pthread.dylib         0x34101e03 _pthread_start + 115
10  libsystem_pthread.dylib         0x340ffb8c thread_start + 4

Thread 2 Crashed:
0   libsystem_kernel.dylib          0x34084dfc __pthread_kill + 8
1   libsystem_pthread.dylib         0x34102d33 pthread_kill + 59
2   libsystem_c.dylib               0x34024905 abort + 73
3   libsystem_malloc.dylib          0x340b53ab szone_error + 331
4   libsystem_malloc.dylib          0x340b5655 free_list_checksum_botch + 25
5   libsystem_malloc.dylib          0x340ad3ff tiny_malloc_from_free_list + 1023
6   libsystem_malloc.dylib          0x340abeb7 szone_malloc_should_clear + 219
7   libsystem_malloc.dylib          0x340abda7 malloc_zone_malloc + 87
8   CoreFoundation                  0x26157e11 _CFRuntimeCreateInstance + 289
9   ImageIO                         0x271d2d95 CGImageMetadataCreateMutable + 61
10  ImageIO                         0x271d2cdd CGImagePlusCreateWithSession + 413
11  ImageIO                         0x271d2825 makeImagePlus + 809
12  ImageIO                         0x271d20cd CGImageSourceCreateImageAtIndex + 157
13  UIKit                           0x2984c3ff _UIImageRefFromData + 259
14  UIKit                           0x299989bd -[UIImage(UIImagePrivate) _initWithData:preserveScale:cache:] + 73
15  UIKit                           0x2984c2f1 -[UIImage initWithData:] + 25
16  UIKit                           0x2984c2c1 +[UIImage imageWithData:] + 49
17  MyApplication                   0x000a0f8b 0x98000 + 36747
18  MyApplication                   0x0045cf33 0x98000 + 3952435
19  MyApplication                   0x000efb77 0x98000 + 359287
20  MyApplication                   0x000ef74f 0x98000 + 358223
21  MyApplication                   0x002b77f1 0x98000 + 2226161
22  MyApplication                   0x002564c9 0x98000 + 1828041
23  MyApplication                   0x00255af3 0x98000 + 1825523
24  MyApplication                   0x002575fb 0x98000 + 1832443
25  MyApplication                   0x00340275 0x98000 + 2785909
26  MyApplication                   0x0033df0b 0x98000 + 2776843
27  MyApplication                   0x00334a79 0x98000 + 2738809
28  MyApplication                   0x001ca399 0x98000 + 1254297
29  MyApplication                   0x001ca825 0x98000 + 1255461
30  MyApplication                   0x0020eaf9 0x98000 + 1534713
31  MyApplication                   0x001c3f53 0x98000 + 1228627
32  MyApplication                   0x001c3a9f 0x98000 + 1227423
33  MyApplication                   0x001c2905 0x98000 + 1222917
34  MyApplication                   0x00201fc9 0x98000 + 1482697
35  MyApplication                   0x0027f19d 0x98000 + 1995165
36  MyApplication                   0x001c45dd 0x98000 + 1230301
37  MyApplication                   0x0027f5e3 0x98000 + 1996259
38  MyApplication                   0x001c3a9f 0x98000 + 1227423
39  MyApplication                   0x001c2905 0x98000 + 1222917
40  MyApplication                   0x001c2367 0x98000 + 1221479
41  MyApplication                   0x001c82ab 0x98000 + 1245867
42  MyApplication                   0x001970bb 0x98000 + 1044667
43  MyApplication                   0x00195ca1 0x98000 + 1039521
44  MyApplication                   0x001a0839 0x98000 + 1083449
45  MyApplication                   0x00197f51 0x98000 + 1048401
46  MyApplication                   0x0023886b 0x98000 + 1706091
47  MyApplication                   0x00237b4b 0x98000 + 1702731
48  MyApplication                   0x00242d6f 0x98000 + 1748335
49  MyApplication                   0x00243349 0x98000 + 1749833
50  MyApplication                   0x0026c96d 0x98000 + 1919341
51  MyApplication                   0x0022be03 0x98000 + 1654275
52  MyApplication                   0x0022198b 0x98000 + 1612171
53  MyApplication                   0x0022d3f1 0x98000 + 1659889
54  MyApplication                   0x0022c181 0x98000 + 1655169
55  MyApplication                   0x0022af71 0x98000 + 1650545
56  MyApplication                   0x0022b1ed 0x98000 + 1651181
57  MyApplication                   0x00227b83 0x98000 + 1637251
58  MyApplication                   0x00226b5f 0x98000 + 1633119
59  MyApplication                   0x002264e7 0x98000 + 1631463
60  MyApplication                   0x00222443 0x98000 + 1614915
61  MyApplication                   0x00221cc9 0x98000 + 1613001
62  MyApplication                   0x00227ccb 0x98000 + 1637579
63  MyApplication                   0x004dd4e3 0x98000 + 4478179
64  MyApplication                   0x001ecd1d 0x98000 + 1395997
65  MyApplication                   0x0023c13b 0x98000 + 1720635
66  MyApplication                   0x00237857 0x98000 + 1701975
67  MyApplication                   0x0023b867 0x98000 + 1718375
68  MyApplication                   0x003b5b15 0x98000 + 3267349
69  MyApplication                   0x000df667 0x98000 + 292455
70  MyApplication                   0x00492369 0x98000 + 4170601
71  MyApplication                   0x004d9bd9 0x98000 + 4463577
72  libsystem_pthread.dylib         0x34101e91 _pthread_body + 137
73  libsystem_pthread.dylib         0x34101e03 _pthread_start + 115
74  libsystem_pthread.dylib         0x340ffb8c thread_start + 4

Thread 3 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 3:
0   libsystem_kernel.dylib          0x340712a0 kevent64 + 24
1   libdispatch.dylib               0x33faa9fd _dispatch_mgr_invoke + 277
2   libdispatch.dylib               0x33fa020f _dispatch_mgr_thread + 35

Thread 4:
0   libsystem_kernel.dylib          0x340859cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x340ffea9 _pthread_wqthread + 789
2   libsystem_pthread.dylib         0x340ffb80 start_wqthread + 4

Thread 5:
0   libsystem_kernel.dylib          0x340859cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x340ffea9 _pthread_wqthread + 789
2   libsystem_pthread.dylib         0x340ffb80 start_wqthread + 4

Thread 6:
0   libsystem_kernel.dylib          0x340859cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x340ffea9 _pthread_wqthread + 789
2   libsystem_pthread.dylib         0x340ffb80 start_wqthread + 4

Thread 7:
0   libsystem_kernel.dylib          0x340859cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x340ffea9 _pthread_wqthread + 789
2   libsystem_pthread.dylib         0x340ffb80 start_wqthread + 4

Thread 8:
0   libsystem_kernel.dylib          0x34084b38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x341013f5 _pthread_cond_wait + 517
2   libsystem_pthread.dylib         0x34102319 pthread_cond_timedwait + 41
3   MyApplication                   0x004d970f 0x98000 + 4462351
4   MyApplication                   0x0047c09d 0x98000 + 4079773
5   MyApplication                   0x003b507b 0x98000 + 3264635
6   MyApplication                   0x003b5acb 0x98000 + 3267275
7   MyApplication                   0x003b63cf 0x98000 + 3269583
8   MyApplication                   0x000df667 0x98000 + 292455
9   MyApplication                   0x00492369 0x98000 + 4170601
10  MyApplication                   0x004d9bd9 0x98000 + 4463577
11  libsystem_pthread.dylib         0x34101e91 _pthread_body + 137
12  libsystem_pthread.dylib         0x34101e03 _pthread_start + 115
13  libsystem_pthread.dylib         0x340ffb8c thread_start + 4

Thread 2 crashed with ARM Thread State (32-bit):
    r0: 0x00000000    r1: 0x00000000      r2: 0x00000000      r3: 0x0000004d
    r4: 0x00000006    r5: 0x00a1c000      r6: 0x16f2c2a4      r7: 0x00a18f00
    r8: 0x00000001    r9: 0x340bb8b6     r10: 0x00824000     r11: 0x340bbac7
    ip: 0x00000148    sp: 0x00a18ef4      lr: 0x34102d37      pc: 0x34084dfc
  cpsr: 0x00000010
ios
codenameone
asked on Stack Overflow Feb 15, 2015 by Eddie Carpenter • edited Feb 15, 2015 by Eddie Carpenter

2 Answers

1

I have solved the problem by forcing the CodenameOne build server to use the old VM until the problems with the new VM is sorted.

To force the build server to use the old VM one has to specify the following Build Hint

ios.newVM = false
answered on Stack Overflow Feb 16, 2015 by Eddie Carpenter
0

Crash logs don't help much with debugging on iOS since they need to be symbolicated and they can't be with the build server architecture.

I'm guessing this is related to recent regressions in the new iOS VM which is something we are addressing e.g. this issue https://code.google.com/p/codenameone/issues/detail?id=1348

answered on Stack Overflow Feb 16, 2015 by Shai Almog

User contributions licensed under CC BY-SA 3.0