Lua: celestia:newframe() crashes

Report bugs, bug fixes and workarounds here.
Topic author
Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Lua: celestia:newframe() crashes

Post #1by Harry » 05.09.2003, 22:21

Hi,

Calling celestia:newframe(...) crashes with segfault (Windows 1.3.1.9, Linux CVS 2003-09-04).

AFAICS the problem is in celestia/src/celestia/celx.cpp, celestia_newframe():
A FrameOfReference is created even if ref and/or target are NULL. And the Frame-metatable is not registered anyway.

However, it still crashes for me with this patch when using "lock" as coordsys :(

Code: Select all

*** orig/celestia/src/celestia/celx.cpp 2003-07-20 22:14:19.000000000 +0200
--- modified/celestia/src/celestia/celx.cpp     2003-09-05 23:11:05.000000000 +0200
***************
*** 1865,1870 ****
--- 1865,1872 ----
                  {
                      lua_pushstring(l, "newframe: two objects required for lock frame");
                      lua_error(l);
+                 } else {
+                     frame_new(l, FrameOfReference(coordSys, *ref, *target));
                  }
              }
              else
***************
*** 1875,1884 ****
                  {
                      lua_pushstring(l, "newframe: one object argument required for frame");
                      lua_error(l);
                  }
!             }
!             
!             frame_new(l, FrameOfReference(coordSys, *ref, *target));
          }
      }
      else
--- 1877,1886 ----
                  {
                      lua_pushstring(l, "newframe: one object argument required for frame");
                      lua_error(l);
+                 } else {
+                     frame_new(l, FrameOfReference(coordSys, *ref));
                  }
!             }   
          }
      }
      else
***************
*** 1950,1955 ****
--- 1952,1958 ----
      CreateObserverMetaTable(state);
      CreateCelestiaMetaTable(state);
      CreatePositionMetaTable(state);
+     CreateFrameMetaTable(state);
 
      // Create the celestia object
      lua_pushstring(state, "celestia");

(I hope this is useable ;) )

HTH,

Harry[/code]

Return to “Bugs”