Hello,

it seem using an application as a PG_APP_TOOLBAR, which load a theme
with only some specifications for button, and another application as a
PG_APP_NORMAL, with a "kind of scrolled list" of PG_WIDGET_FLATBUTTON
crash the pgserver (at least on Linux/x86/SDL, don't have try other for
the moment).

You can test this with the attached files :

1. compile the two files test_sb.c and test2_sb.c
2. compile the theme temp.th
3. start your server
4. start test_sb and test2_sb
5. move your mouse on the toolbar (bottom of the window)

It's crash with :
    X Error of failed request:  BadValue (integer parameter out of range for operation)
    Major opcode of failed request:  146 (MIT-SHM)
    Minor opcode of failed request:  3 (X_ShmPutImage)
    Value in failed request:  0xffe7
    Serial number of failed request:  94

If I change one of the following thing the server don't crash anymore :
- don't load the theme
- remove the object button from the theme and put something else (for
  example a default font)
- don't have two calls to pgRegisterApp() (one application whos create
  the toolbar and the list of flatbuttons.
- remove the scroll
- have a pgserver window big enough to have nothing to scroll

Can I make something to have no more crash ?

Thanks in advance.

                Olivier
-- 
Olivier Bornet                      SMARTDATA SA
[EMAIL PROTECTED]         Centre du Parc
http://www.smartdata.ch             av. des Pr�s-Beudin 20
Phone +41-27-723'55'03              1920 Martigny
Fax   +41-27-723'55'19              Phone +41-27-723'55'18
#include <picogui.h>

int main( int argc, char ** argv ) {
  pghandle wButtonsBox;
  pghandle wScroll;
  int i;

  /* init the link with PicoGUI server */
  pgInit( argc, argv );

  /* register a "test application" */
  pgRegisterApp(PG_APP_NORMAL,"Test Application",0);

  /* load a theme */
  pgLoadTheme( pgFromFile( "temp.th" ));

  /* create a box for putting the buttons */
  wButtonsBox = pgNewWidget( PG_WIDGET_BOX, 0, 0 );
  pgSetWidget( wButtonsBox, PG_WP_SIDE, PG_S_ALL, 0 );

  /* add the scroll bar */
  wScroll = pgNewWidget( PG_WIDGET_SCROLL, PG_DERIVE_BEFORE, wButtonsBox );

  /* bind the scroll bar to the buttons box */
  pgSetWidget( wScroll, PG_WP_BIND, wButtonsBox, 0 );

  /* add some buttons */
  for( i = 0; i < 40; i++ ) {

    pgNewWidget( PG_WIDGET_FLATBUTTON, PG_DERIVE_INSIDE, wButtonsBox );
    pgSetWidget( PGDEFAULT,
                 PG_WP_SIDE, PG_S_TOP,
                 0 );

  }
  
  /* the main loop */
  pgEventLoop();

  return 0;

}
#include <picogui.h>

int main( int argc, char ** argv ) {

  /* init the link with PicoGUI server */
  pgInit( argc, argv );

  /* Register a toolbar application to contain 'Dummy' button */
  pgRegisterApp( PG_APP_TOOLBAR, "ToolBar",
                 PG_APPSPEC_SIDE, PG_S_BOTTOM,
                 0 );

  /* load a theme */
  pgLoadTheme( pgFromFile( "temp.th" ));

  /* the main loop */
  pgEventLoop();

  return 0;

}
object button {
  /* Rounded rectangle */
  bgfill = fillstyle {
    SetColor(bgcolor);
    Rect(x+1,y+1,w-2,h-2);
    SetColor(0x000000);
    Slab(x+4,y,w-8,1);
    Slab(x+4,y+h-1,w-8,1);
    Bar(x,y+4,1,h-8);
    Bar(x+w-1,y+4,1,h-8);
    Line(x,y+3,3,-3);
    Line(x+w-1,y+3,-3,-3);
    Line(x,y+h-4,3,3);
    Line(x+w-1,y+h-4,-3,3);
    Pixel(x+1,y+1,1,1);
    Pixel(x+w-2,y+1,1,1);
    Pixel(x+1,y+h-2,1,1);
    Pixel(x+w-2,y+h-2,1,1);
  };
}

Reply via email to