gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gfx/libutil/ObjectSto...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gfx/libutil/ObjectSto...
Date: Wed, 04 Dec 2002 05:54:22 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/12/04 05:54:22

Modified files:
        gfx/jni        : GzzGL-jni.cxx 
        gfx/libutil    : ObjectStorer.hxx 
        gzz/gfx/gl     : GL.java 

Log message:
        Deleting wrong type of renderable: BAAD

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/ObjectStorer.hxx.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.24&tr2=1.25&r1=text&r2=text

Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.65 gzz/gfx/jni/GzzGL-jni.cxx:1.66
--- gzz/gfx/jni/GzzGL-jni.cxx:1.65      Tue Dec  3 14:14:12 2002
+++ gzz/gfx/jni/GzzGL-jni.cxx   Wed Dec  4 05:54:22 2002
@@ -896,21 +896,25 @@
 
 JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable0
   (JNIEnv *, jclass, jint id) {
+      DBG(dbg) << "Delete renderable0 "<<id<<"\n";
       renderable0s.remove(id);
   }
 
 JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable1
   (JNIEnv *, jclass, jint id) {
+      DBG(dbg) << "Delete renderable1 "<<id<<"\n";
       renderable1s.remove(id);
   }
 
 JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable2
   (JNIEnv *, jclass, jint id) {
+      DBG(dbg) << "Delete renderable2 "<<id<<"\n";
       renderable2s.remove(id);
   }
 
 JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable3
   (JNIEnv *, jclass, jint id) {
+      DBG(dbg) << "Delete renderable3 "<<id<<"\n";
       renderable3s.remove(id);
   }
 // functions
Index: gzz/gfx/libutil/ObjectStorer.hxx
diff -u gzz/gfx/libutil/ObjectStorer.hxx:1.8 
gzz/gfx/libutil/ObjectStorer.hxx:1.9
--- gzz/gfx/libutil/ObjectStorer.hxx:1.8        Tue Dec  3 14:14:12 2002
+++ gzz/gfx/libutil/ObjectStorer.hxx    Wed Dec  4 05:54:22 2002
@@ -45,6 +45,14 @@
         */
        void remove(int p) {
            if(p == 0) return;
+           if((unsigned)p >= vec.size()) {
+               cerr << "Trying to delete element past end "<<p<<"\n";
+               return;
+           }
+           if(vec[p] == NULL) {
+               cerr << "Trying to delete null element! "<<p<<"\n";
+               return;
+           }
            delete vec[p];
            vec[p] = 0;
        }
Index: gzz/gzz/gfx/gl/GL.java
diff -u gzz/gzz/gfx/gl/GL.java:1.24 gzz/gzz/gfx/gl/GL.java:1.25
--- gzz/gzz/gfx/gl/GL.java:1.24 Wed Dec  4 04:47:09 2002
+++ gzz/gzz/gfx/gl/GL.java      Wed Dec  4 05:54:22 2002
@@ -39,7 +39,7 @@
  */
 public class GL {
     public static boolean dbg = false;
-    private static void pa(String s) { System.err.println(s); }
+    private static void pa(String s) { System.out.println(s); }
 
     /** Initialize the native library by creating
      * OpenGL contexts and the like.
@@ -142,7 +142,7 @@
        /** During garbage collection: destroy the C++ object associated with 
this object.
         */
        public void finalize() {
-           if(this.dbg) pa("Finalizing "+this+" "+id);
+           if(GL.dbg) pa("Finalizing "+this+" "+id);
            // Would like to
            //          deleteObj();
            // but can't due to thread problems.
@@ -154,6 +154,7 @@
                            RenderInfo info2
                            )  { }
        public void deleteObject() {
+           if(GL.dbg) pa("DeleteObj "+this+" "+id);
            deleteObj();
            id = 0;
        }
@@ -198,7 +199,7 @@
            return addToList(list, cur);
        }
        protected void deleteObj() {
-           deleteRenderable1(getId());
+           deleteRenderable0(getId());
        }
     }
     static private native void deleteRenderable0(int id);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]