--- Begin Message ---
Package: eboard
Version: 0.6.2-1
Severity: normal
Tags: patch
I'm running at 1280x1024 desktop resolution and when I maximize eboard
it will crash because the memory for the actual board is a compile
time constant. This patch makes it dynamic as well as dynamically
allocating the memory for the graphics size changes.
The other two things this patch includes is declaring class
destructors as virtual or creating an empty destructor to eliminate
the compiler warnings about classes with virtual functions not having
virtual destructors. I also removed unused variables.
Index: ChangeLog
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/ChangeLog,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 ChangeLog
13a14,22
> * [all] fixed warnings about non-virtual destructors, removed
> unused variables -- David Fries <[EMAIL PROTECTED]>
>
> * [all] The maximum board size was a #define and caused the
> program to crash when maximized larger than that value.
> Fixed the problem by making it a dynamic value and
> allocating the required memory when the size changes.
> -- David Fries <[EMAIL PROTECTED]>
>
Index: board.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/board.cc,v
retrieving revision 1.2
diff -r1.2 board.cc
44d43
< GtkWidget *tl2;
98,99c97,108
< buffer=gdk_pixmap_new(MainWindow::RefWindow,SCRAP_WIDTH,SCRAP_WIDTH,-1);
< clkbar=gdk_pixmap_new(MainWindow::RefWindow,250,SCRAP_WIDTH,-1);
---
>
> sqside=59; // Setting the initial square side
> sqtotal=sqside*8;
> /* There appears to be a border around the game board each square
> * has a single pixel border on the top and left side the right and
> * bottom side border is part of the adjacent square, except on the
> * right most squares and bottom squares, where there aren't squares
> * to the right or bottom. +1 gives space for this unaccounted for
> * border. David Fries <[EMAIL PROTECTED]> Sept 2002
> */
> buffer=gdk_pixmap_new(MainWindow::RefWindow,sqtotal+1,sqtotal+1,-1);
> clkbar=gdk_pixmap_new(MainWindow::RefWindow,250,sqtotal+1,-1);
102,103c111,112
< scrap=(rgbptr)g_malloc(SCRAP_WIDTH*SCRAP_WIDTH*3);
< memset(scrap,0,SCRAP_WIDTH*SCRAP_WIDTH*3);
---
> scrap=(rgbptr)g_malloc((sqtotal+1)*(sqtotal+1)*3);
> memset(scrap,0,(sqtotal+1)*(sqtotal+1)*3);
352c361
< C.prepare(clkbar,gc,0,0,250,SCRAP_WIDTH);
---
> C.prepare(clkbar,gc,0,0,250,sqtotal);
630c639
< int i,j,k,rate;
---
> int i,rate;
903c912
< int i,j;
---
> int i;
1158c1167
< gdk_draw_rectangle(buffer,gc,TRUE,0,i,i,SCRAP_WIDTH-Height());
---
> gdk_draw_rectangle(buffer,gc,TRUE,0,i,i,sqtotal-Height());
1205c1214
< int i,j,k,w,h,ww,wh,sq,pw,fw,fh;
---
> int i,w,h,sq,pw,fw,fh;
1223c1232
< if (fh>SCRAP_WIDTH) {
---
> if (fh>me->sqtotal) {
1225,1226c1234,1235
< 0,SCRAP_WIDTH,fw,fh-SCRAP_WIDTH);
< fh=SCRAP_WIDTH;
---
> 0,me->sqtotal,fw,fh-me->sqtotal);
> fh=me->sqtotal;
1229,1230c1238,1239
< if (fw>SCRAP_WIDTH)
< fw=SCRAP_WIDTH;
---
> if (fw>me->sqtotal)
> fw=me->sqtotal;
1325a1335
> int old_sqside;
1365a1376
> old_sqside=me->sqside;
1366a1378
> me->sqtotal=sq*8;
1374c1386,1403
< memset(me->scrap,0,SCRAP_WIDTH*SCRAP_WIDTH*3);
---
> if(old_sqside != me->sqside)
> {
> gdk_pixmap_unref(me->clkbar);
> gdk_pixmap_unref(me->buffer);
> /* There appears to be a border around the game board each square
> * has a single pixel border on the top and left side the right and
> * bottom side border is part of the adjacent square, except on the
> * right most squares and bottom squares, where there aren't squares
> * to the right or bottom. +1 gives space for this unaccounted for
> * border. David Fries <[EMAIL PROTECTED]> Sept 2002
> */
> me->buffer=gdk_pixmap_new(MainWindow::RefWindow,me->sqtotal+1,
> me->sqtotal+1,-1);
> me->clkbar=gdk_pixmap_new(MainWindow::RefWindow,250,me->sqtotal+1,-1);
> me->clkgc=gdk_gc_new(me->clkbar);
> me->scrap=(rgbptr)g_malloc((me->sqtotal+1)*(me->sqtotal+1)*3);
> memset(me->scrap,0,(me->sqtotal+1)*(me->sqtotal)*3);
> }
1390c1419
< me->morey+me->bory+j*sq,SCRAP_WIDTH,
---
> me->morey+me->bory+j*sq,me->sqtotal,
1397c1426
< me->morey+me->bory+j*sq,SCRAP_WIDTH,
---
> me->morey+me->bory+j*sq,me->sqtotal,
1405,1406c1434,1435
< SCRAP_WIDTH,SCRAP_WIDTH,
< GDK_RGB_DITHER_NORMAL,me->scrap,SCRAP_WIDTH*3);
---
> me->sqtotal,me->sqtotal,
> GDK_RGB_DITHER_NORMAL,me->scrap,me->sqtotal*3);
1514,1515c1543,1544
< if (sw>SCRAP_WIDTH) sw=SCRAP_WIDTH;
< if (sh>SCRAP_WIDTH) sh=SCRAP_WIDTH;
---
> if (sw>me->sqtotal) sw=me->sqtotal;
> if (sh>me->sqtotal) sh=me->sqtotal;
1630,1631c1659,1660
< if (x > SCRAP_WIDTH) x=SCRAP_WIDTH;
< if (y > SCRAP_WIDTH) y=SCRAP_WIDTH;
---
> if (x > me->sqtotal) x=me->sqtotal;
> if (y > me->sqtotal) y=me->sqtotal;
Index: board.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/board.h,v
retrieving revision 1.2
diff -r1.2 board.h
109c109
< ~Board();
---
> virtual ~Board();
235c235,236
< int sqside;
---
> int sqside; // The distance in pixels along one side of one square.
> int sqtotal; // The distance in pixels along the entire side of the board.
> (8 squares)
286a288
> virtual ~EditBoard() {}
Index: bugpane.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/bugpane.cc,v
retrieving revision 1.2
diff -r1.2 bugpane.cc
150,152d149
< if (! me->pixbuf)
< me->pixbuf=gdk_pixmap_new(widget->window,SCRAP_WIDTH,SCRAP_WIDTH,-1);
<
155,156c152,163
< if (ww>SCRAP_WIDTH) ww=SCRAP_WIDTH;
< if (wh>SCRAP_WIDTH) wh=SCRAP_WIDTH;
---
>
> // If the width or height have changed we need a new pixmap
> if( me->pixbuf && (ww != me->pixw || wh != me->pixh))
> {
> gdk_pixmap_unref(me->pixbuf);
> me->pixbuf=0;
> me->pixw=ww;
> me->pixh=wh;
> }
> if (! me->pixbuf)
> me->pixbuf=gdk_pixmap_new(widget->window,ww, wh,-1);
>
Index: bugpane.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/bugpane.h,v
retrieving revision 1.2
diff -r1.2 bugpane.h
42c42
< ~BareBoard();
---
> virtual ~BareBoard();
63a64
> int pixw, pixh; // The pixmap width and height
Index: chess.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/chess.cc,v
retrieving revision 1.2
diff -r1.2 chess.cc
174c174
< char s[64],t[64];
---
> char s[64];
261d260
< char z[32];
856d854
< list<Position>::iterator gli;
Index: chess.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/chess.h,v
retrieving revision 1.2
diff -r1.2 chess.h
76c76
< ~ChessGame();
---
> virtual ~ChessGame();
Index: clock.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/clock.h,v
retrieving revision 1.2
diff -r1.2 clock.h
45c45
< ~ChessClock();
---
> virtual ~ChessClock();
Index: dlg_connect.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/dlg_connect.cc,v
retrieving revision 1.2
diff -r1.2 dlg_connect.cc
42d41
< char z[64];
Index: dlg_prefs.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/dlg_prefs.cc,v
retrieving revision 1.2
diff -r1.2 dlg_prefs.cc
658d657
< int i;
693d691
< sigfunc pipeopt;
768d765
< sigfunc pipeopt;
799d795
< sigfunc pipeopt;
Index: global.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/global.h,v
retrieving revision 1.2
diff -r1.2 global.h
108a109
> virtual ~ChannelSplitter() {}
208a210
> virtual ~Global() {}
Index: mainwindow.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/mainwindow.cc,v
retrieving revision 1.2
diff -r1.2 mainwindow.cc
702d701
< GtkWidget *submenu;
1090,1091c1089
< Position *p;
< int id,i,j;
---
> int id;
1626d1623
< int pg;
Index: mainwindow.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/mainwindow.h,v
retrieving revision 1.2
diff -r1.2 mainwindow.h
63a64
> virtual ~InputModeSelector() {}
111a113
> virtual ~MainWindow() {}
Index: movelist.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/movelist.h,v
retrieving revision 1.2
diff -r1.2 movelist.h
39c39
< ~MoveListWindow();
---
> virtual ~MoveListWindow();
Index: network.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/network.cc,v
retrieving revision 1.2
diff -r1.2 network.cc
168c168
< int i,j;
---
> int i;
170c170
< list<char>::iterator di,dj;
---
> list<char>::iterator di;
214c214
< list<char>::iterator di,dj;
---
> list<char>::iterator di;
Index: network.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/network.h,v
retrieving revision 1.2
diff -r1.2 network.h
64a65
> virtual ~PidRing() {}
Index: notebook.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/notebook.cc,v
retrieving revision 1.2
diff -r1.2 notebook.cc
200d199
< vector<Page *>::iterator pi;
Index: notebook.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/notebook.h,v
retrieving revision 1.2
diff -r1.2 notebook.h
61a62
> virtual ~Notebook() {}
Index: pieces.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/pieces.cc,v
retrieving revision 1.2
diff -r1.2 pieces.cc
666c666
< int i,j,c;
---
> int c;
1223c1223
< int i,j,v;
---
> int i,v;
Index: pieces.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/pieces.h,v
retrieving revision 1.2
diff -r1.2 pieces.h
36,37d35
< #define SCRAP_WIDTH 864
<
Index: position.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/position.cc,v
retrieving revision 1.2
diff -r1.2 position.cc
241d240
< piece c;
1116c1115
< int dx,dy;
---
> int dx;
Index: proto_crafty.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/proto_crafty.h,v
retrieving revision 1.2
diff -r1.2 proto_crafty.h
33a34
> virtual ~CraftyProtocol() {}
Index: proto_fics.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/proto_fics.cc,v
retrieving revision 1.2
diff -r1.2 proto_fics.cc
603c603
< char *p,z[64];
---
> char z[64];
646c646
< char *p,z[64];
---
> char z[64];
952c952
< int i,j,n;
---
> int i,j;
1292d1291
< list<Position *>::iterator li;
Index: proto_fics.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/proto_fics.h,v
retrieving revision 1.2
diff -r1.2 proto_fics.h
37c37
< ~FicsProtocol();
---
> virtual ~FicsProtocol();
Index: proto_gnuchess4.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/proto_gnuchess4.h,v
retrieving revision 1.2
diff -r1.2 proto_gnuchess4.h
33a34
> virtual ~GnuChess4Protocol() {}
Index: proto_sjeng.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/proto_sjeng.h,v
retrieving revision 1.2
diff -r1.2 proto_sjeng.h
34a35
> virtual ~SjengProtocol() {}
Index: proto_xboard.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/proto_xboard.h,v
retrieving revision 1.2
diff -r1.2 proto_xboard.h
43a44
> virtual ~XBoardProtocol() {}
Index: quickbar.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/quickbar.h,v
retrieving revision 1.2
diff -r1.2 quickbar.h
61a62
> virtual ~QuickBar() {}
Index: script.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/script.cc,v
retrieving revision 1.2
diff -r1.2 script.cc
224c224
< char z[256],fp[512],*p;
---
> char z[256],fp[512];
Index: seekgraph.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/seekgraph.h,v
retrieving revision 1.2
diff -r1.2 seekgraph.h
62a63
> virtual ~SeekGraph() {}
Index: sound.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/sound.cc,v
retrieving revision 1.2
diff -r1.2 sound.cc
313d312
< char z[256];
Index: text.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/text.cc,v
retrieving revision 1.2
diff -r1.2 text.cc
96d95
< bool confirmed;
Index: text.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/text.h,v
retrieving revision 1.2
diff -r1.2 text.h
50a51
> virtual ~Searchable() {}
139c140
< ~DetachedConsole();
---
> virtual ~DetachedConsole();
Index: util.cc
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/util.cc,v
retrieving revision 1.2
diff -r1.2 util.cc
443c443
< int i,j,t,s;
---
> int t,s;
Index: util.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/util.h,v
retrieving revision 1.2
diff -r1.2 util.h
77a78
> virtual ~ExactStringPat() {}
87a89
> virtual ~CIExactStringPat() {}
Index: widgetproxy.h
===================================================================
RCS file: /mnt/david/debian/eboard/cvs_root/eboard_cvs/widgetproxy.h,v
retrieving revision 1.2
diff -r1.2 widgetproxy.h
85c85
< ~UnboundedProgressWindow();
---
> virtual ~UnboundedProgressWindow();
116c116
< ~TextPreview();
---
> virtual ~TextPreview();
136c136
< ~FileDialog();
---
> virtual ~FileDialog();
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux SpacedOut 2.4.19 #23 Sun Aug 18 19:34:00 CDT 2002 i586
Locale: LANG=C, LC_CTYPE=C
Versions of packages eboard depends on:
ii gdk-imlib1 1.9.11-3 Gdk-Imlib is an imaging library fo
ii libc6 2.2.5-14 GNU C Library: Shared libraries an
ii libglib1.2 1.2.10-3 The GLib library of C routines
ii libgtk1.2 1.2.10-9 The GIMP Toolkit set of widgets fo
ii libstdc++2.10-glibc2.2 1:2.95.4-9 The GNU stdc++ library
ii xlibs 4.1.0-13 X Window System client libraries
--- End Message ---