Problems opening a simple window

5 posts / 0 new
Last post
alfkil
alfkil's picture
Offline
Last seen: 3 months 3 days ago
Joined: 2011-05-10 22:02
Problems opening a simple window

I am using this code to create a custom window.

  1. windowObject = WindowObject,
  2. WA_ScreenTitle, "Spotless",
  3. WA_Title, "Spotless",
  4. WA_SizeGadget, TRUE,
  5. WA_DragBar, TRUE,
  6. WA_CloseGadget, TRUE,
  7. WA_Activate, TRUE,
  8.  
  9. // WA_DepthGadget, TRUE, //This line crashes the program
  10.  
  11. /* WINDOW_ParentLayout, HLayoutObject, //These lines make it work again
  12. LAYOUT_AddChild, ListBrowserObject,
  13. ListBrowserEnd,
  14. EndHGroup,
  15. */
  16. EndWindow;
  17.  
  18. if (windowObject) {
  19. _windowPointer = (struct Window *) RA_OpenWindow (windowObject);
  20. }

And I am using this (preliminary) code to control it.

  1. bool close = false;
  2.  
  3. while (!close) {
  4. uint32 result = IExec->Wait (windowSignalMask() | SIGBREAKF_CTRL_C);
  5.  
  6. if (result & SIGBREAKF_CTRL_C) {
  7. close = true;
  8. }
  9.  
  10. bool done = false;
  11. while(!done) {
  12. uint32 Class;
  13. uint16 Code;
  14. Class = IIntuition->IDoMethod (windowObject, WM_HANDLEINPUT, &Code);
  15. if(Class == WMHI_LASTMSG) {
  16. done = true;
  17. } else {
  18. switch (Class & WMHI_CLASSMASK) {
  19. case WMHI_CLOSEWINDOW:
  20. close = true;
  21. break;
  22. }
  23. }
  24. }
  25. }
  26. closeWindow ();

Adding the depth gadget makes the application crash as soon as you try to resize the window. Adding content, that increases the initial size of the window makes it "safe" again. This code should be fairly standard, no mysterious entities.

This irritates me quite a bit, because I would like to be able to generate dynamically modifiable windows, that initially have only generic attributes. Can anyone confirm, that this is a real issue?

EDIT: Maybe this issue is triggered by the windowing theme. When resetting theme to default in GUI prefs, the crash does not occur.

EDIT EDIT: The issue still remains though with the customized window frames setting on.

broadblues
broadblues's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2012-05-02 21:48
Re: Problems opening a simple window

AS a general rule you should avoid making a window smaller than it's contents, including it's border gadgets. Things get un predicatable if you do that, in a perfect world all gadgets would play absolutely safe, but the world isn't perfect. Windowe class handles making the window big enough to hold it's top layout, but doesn't to my knowledge take any account of the system gadgets. If open an intuition window directly you always need to deal with this.

There is no reason to open a 'zero sized' window anyway, but should you really need to make it border and gadgetless!

alfkil
alfkil's picture
Offline
Last seen: 3 months 3 days ago
Joined: 2011-05-10 22:02
Re: Problems opening a simple window

Ok, that makes somewhat sense. I still am a little baffled by the fact, that what counts as the most generic case of window opening (the system call with the least amount of non-default parameters) actually leads to a system meltdown. For me that counts as a brainfart.

broadblues
broadblues's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2012-05-02 21:48
Re: Problems opening a simple window

@alfkil

For efficiancies sake, Amiga OS (whichever flavour) general does very little error checking, relying on the develeoper to follow *all* the needed steps, this may seem old fashioned, but hey it's a retro OS :-)

alfkil
alfkil's picture
Offline
Last seen: 3 months 3 days ago
Joined: 2011-05-10 22:02
Re: Problems opening a simple window

Retro or not, it still counts to me as a case of lacking the least amount of testing. I don't see the point in not fixing it. Unless, of course, that some kind of backwards compatibility requires it to crash. ;)

Log in or register to post comments