Skip to content

yet another IOS hard crash #1960

@ddyer0

Description

@ddyer0

The attached hard crashes on IOS, works fine on the simulator and android. The code it
is derived from has been working fine on IOS, too, so this is a very recent development.
See https://groups.google.com/forum/#!topic/codenameone-discussions/cIVrbcKnBew

package dtest.boardspace;
//
// this version, when built for IOS and the resulting sources are compiled,
// generates a warning that should be heeded for the double[][] = new .. clause
//
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Label;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;


import com.codename1.ui.Graphics;
import com.codename1.ui.layouts.BorderLayout;

import java.util.Random;


abstract class cell<FINALTYPE>
{	int row;
	char col;
	cell<FINALTYPE>next  = null;
}
class chip
{
	
}
class TestCell extends cell<chip>
{
}
abstract class BaseBoard
{
}
abstract class RBoard<CELLTYPE extends cell<CELLTYPE>>  extends BaseBoard
{
}
abstract class gBoard<CELLTYPE extends cell<CELLTYPE>> extends RBoard<CELLTYPE>
{
    public abstract int BCtoXindex(char col,int row);
    public abstract int BCtoYindex(char col,int row);
    public abstract int YindexToBC(int x,int y);
    public abstract char XindexToBC(int x,int y);
    public abstract CELLTYPE newcell(char col,int row);
    // return true if actually incremented
    private cell<CELLTYPE>[][]board=null;
    cell<CELLTYPE> allCells = null;
	cell<CELLTYPE>[] cellArray = null;
	
 	@SuppressWarnings("unchecked")
	public void createBoard(int xdim,int ydim)
    {  
    	board = new cell[xdim][ydim];
    	allCells=null;
    	cellArray = null;
     }
	
    // this is used only during board construction, when we populate
    // the board array with cells, or subtypes of cells.
    public void SetBoardCell(char col,int row,CELLTYPE con)
    {	int y = BCtoYindex(col,row);
		int x = BCtoXindex(col,row);
		char nc = XindexToBC(x,y);
		int nr = YindexToBC(x,y);
		System.out.println("asign "+nc+" "+nr);
		// a little consistency check
		//System.out.println("C "+nc + col);
		//Assert(((nc==col) && (nr==row)),"%s,%s encodes correctly",col,row);
		board[x][y]=con;
    }
	public void initBoard(int ncols,int nrows)
	{
        createBoard(ncols,(nrows * 2));

    	for(int co=0;co<ncols;co++)
    	{ char col = (char)('A'+co);
    	  for(int ro=0;ro<nrows;ro++)
	    	{	int row = 1+ro;
	    		CELLTYPE nc = newcell(col,row);
	    		SetBoardCell(col,row,nc);
	    		nc.next = allCells;
	    		allCells = nc;
	    	}
    	}
  
	}}
	
	class TestBoard extends  gBoard
	{	public TestBoard()
		{
		initBoard(10,10);
		}
		public int BCtoXindex(char col, int row) {
			return 0;
		}
		public int BCtoYindex(char col, int row) {
			return 0;
		}
		public int YindexToBC(int x, int y) {
			return 0;
		}
		public char XindexToBC(int x, int y) {
			return 0;
		}
		public TestCell newcell(char col, int row) {
			return new TestCell();
		}
	}

public class Dtest  {
	
    private Form current;
    @SuppressWarnings("unused")
	private Resources theme;
    TestBoard b = null;
    public void init(Object context) {
    theme = UIManager.initFirstTheme("/theme");
     }

    public void start() {
        Form hi = new Form("Hi >>0 World");
        current = hi;
        current.show();
        hi.setLayout(new BorderLayout());
        b = new TestBoard();

        hi.addComponent(BorderLayout.CENTER, new Label("Hi Overlay World 2") {

        	
            @Override
            public void paint(Graphics g) {
             	int w = getWidth();
            	int h = getHeight();
             	g.setColor(0x8f8f9f7f);
            	g.fillRect(0,0,w,h);
            	g.setColor(0);
 
            
            	repaint();
            }
            
        });
        hi.show();
        
    }

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



}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions