[ wxwindows-Bugs-1728397 ] create new wxRadioBox causes C++ Builder 6 to crash

SourceForge.net noreply at sourceforge.net
Sun Jun 17 19:20:06 PDT 2007


Bugs item #1728397, was opened at 2007-05-30 08:24
Message generated for change (Comment added) made by sf-robot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1728397&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxMSW specific
Group: Must fix
>Status: Closed
Resolution: None
Priority: 5
Private: No
Submitted By: microtek (microtek21)
Assigned to: chris elliott (biol75)
Summary: create new wxRadioBox causes C++ Builder 6 to crash

Initial Comment:
The below code cause C++ Builder 6 to pop a "Danger" message "Stack overflow - save your work and restart C++ Builder."

wxRadioBox *radioBox = new wxRadioBox();
or
wxArrayString strings;
strings.Add("One");
strings.Add("Two");
wxRadioBox *radioBox = new wxRadioBox(panel, -1, "", wxDefaultPosition, wxDefaultSize, strings, 2, wxRA_SPECIFY_ROWS);



----------------------------------------------------------------------

>Comment By: SourceForge Robot (sf-robot)
Date: 2007-06-17 19:20

Message:
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

----------------------------------------------------------------------

Comment By: chris elliott (biol75)
Date: 2007-06-03 13:26

Message:
Logged In: YES 
user_id=84704
Originator: NO

I don't see a bug with adding the simple constructor code to an empty
frame. Ive tried it with 3 differnt versions of Borlan'd compiler. 

I really need a simple test case, eg adding a few lines to the minimal
sample to create a wxRadioBox. Or, does the controls.cpp sample compile for
you (It has at least 2 wxradioBoxes:

    wxRadioBox *radio2 = new MyRadioBox( panel, ID_RADIOBOX, _T("&That"),
wxPoint(10,160), wxDefaultSize, WXSIZEOF(choices2), choices2, 1,
wxRA_SPECIFY_ROWS );
    m_radio = new wxRadioBox( panel, ID_RADIOBOX, _T("T&his"),
wxPoint(10,10), wxDefaultSize, WXSIZEOF(choices), choices, 1,
wxRA_SPECIFY_COLS );

I still think your error message from the compiler looks like a recursion
prblem

chris

----------------------------------------------------------------------

Comment By: microtek (microtek21)
Date: 2007-05-31 09:07

Message:
Logged In: YES 
user_id=1774531
Originator: YES

Let ignore the second section of code. 
This happens with this line of code too. 
wxRadioBox *radioBox = new wxRadioBox();

I don't think I got into recursion problem, since I tried most of other
wxXXXXXX components, they are working fine.




----------------------------------------------------------------------

Comment By: chris elliott (biol75)
Date: 2007-05-31 08:57

Message:
Logged In: YES 
user_id=84704
Originator: NO

and so, where is panel [as in wxRadioBox *radioBox = new wxRadioBox(panel,
-1 ...] declared ? Are you getting a recursion problem ?

chris

----------------------------------------------------------------------

Comment By: microtek (microtek21)
Date: 2007-05-31 08:45

Message:
Logged In: YES 
user_id=1774531
Originator: YES

It happens during compile time. It starts to happen when I add the above
code into the below function:

wxPanel* BNoteBook::BuildTitlePage( wxNotebook* pBNoteBook )
{
  // create first panel, the Title Page, for notebook
  pTitlePage = new wxPanel(pBNoteBook, -1, wxDefaultPosition,
wxDefaultSize);
  pTitlePage->SetAutoLayout(true);

  wxFont defaultFont = pTitlePage->GetFont();
  wxFont newFont(10,wxSWISS, wxNORMAL, wxBOLD);
  pTitlePage->SetFont(newFont);
  wxStaticText *pStaticTextHeading = new wxStaticText(pTitlePage, -1,
"title page",wxPoint(-1,-1), wxSize(-1,-1), wxALIGN_CENTRE);
  pTitlePage->SetFont(defaultFont);

  pTitle1 = new wxTextCtrl(pTitlePage, -1, "tc_title1", wxDefaultPosition,
wxSize(230, 25));
  pTitle1->Enable(false);

  pTitle2 = new wxTextCtrl(pTitlePage, -1, "tc_title2", wxDefaultPosition,
wxSize( 230, 25));
  pTitle2->Enable(false);

  wxStaticBoxSizer *pTitleStaticBoxSizer = new
wxStaticBoxSizer(wxVERTICAL, pTitlePage, wxT("Title of static box
sizer"));
  pTitleStaticBoxSizer->Add( pTitle1, 0, wxALL, 2 );
  pTitleStaticBoxSizer->Add( pTitle2, 0, wxALL, 2 );

  wxBoxSizer *pRightSizer = new wxBoxSizer(wxVERTICAL);
  pRightSizer->AddSpacer(20);
  pRightSizer->Add(pStaticTextHeading, 0, wxALIGN_CENTER);
  pRightSizer->AddSpacer(20);
  pRightSizer->Add(pTitleStaticBoxSizer, 0, wxALIGN_CENTER);
  pRightSizer->AddSpacer(10);
  pRightSizer->Add(new wxStaticBitmap(pTitlePage,-1,
wxBitmap("somebitmap", wxBITMAP_TYPE_BMP_RESOURCE),	wxPoint(-1,-1)), 0);
  ///////////////////////////////

  pButtonNew = new wxBitmapButton( pTitlePage,
ID_BITMAP_BUTTON_TOOL_BAR_CREATE_NEW_FILE, wxBitmap("newbutton",
wxBITMAP_TYPE_BMP_RESOURCE) );

  pButtonOpen = new wxBitmapButton( pTitlePage,
ID_BITMAP_BUTTON_TOOL_BAR_OPEN_EXISTING_FILE, wxBitmap("openbutton",
wxBITMAP_TYPE_BMP_RESOURCE) );

  pButtonRestart = new wxBitmapButton( pTitlePage,
ID_BITMAP_BUTTON_TOOL_BAR_START_OVER, wxBitmap("restrtbutton",
wxBITMAP_TYPE_BMP_RESOURCE) );
  pButtonRestart->Enable(false);

  pCreateNewFileText = new wxStaticText( pTitlePage, -1, "Create a new
file", wxPoint(-1,-1));
  pOpenExistingFileText = new wxStaticText( pTitlePage, -1, "Open an
existing file", wxPoint(-1,-1));
 
  pStartOverText = new wxStaticText(pTitlePage, -1, "Start Over",
wxPoint(-1,-1));
  pStartOverText->Enable(false);

  wxFlexGridSizer *pLeftGridSizer = new wxFlexGridSizer(2);
  pLeftGridSizer->Add(pButtonNew, 0, wxALL, 5);
  pLeftGridSizer->Add(pCreateNewFileText, 0, wxALIGN_CENTER_VERTICAL);
  pLeftGridSizer->Add(pButtonOpen, 0, wxALL, 5);
  pLeftGridSizer->Add(pOpenExistingFileText, 0, wxALIGN_CENTER_VERTICAL);
  pLeftGridSizer->Add(pButtonRestart, 0, wxALL, 5);
  pLeftGridSizer->Add(pStartOverText, 0, wxALIGN_CENTER_VERTICAL);
  
  wxStaticBoxSizer *pUnitStaticBoxSizer = new wxStaticBoxSizer(
wxVERTICAL, pTitlePage, wxT("Units Used") );
  pUnits = new wxChoice(pTitlePage, -1, wxDefaultPosition, wxDefaultSize,
2, Choice1 );
  pUnits->Enable(true);
  pUnitStaticBoxSizer->Add(pUnits);

  wxStaticBoxSizer *p2DTypeStaticBoxSizer = new wxStaticBoxSizer(
wxVERTICAL, pTitlePage, wxT("Type of Problem") );
  p2DType = new wxChoice(pTitlePage, -1, wxDefaultPosition, wxDefaultSize,
4, Choice2 );
  p2DType->Enable(true);
  p2DTypeStaticBoxSizer->Add(p2DType);

  wxBoxSizer *pLeftSizer = new wxBoxSizer(wxVERTICAL);
  pLeftSizer->AddSpacer(20);
  pLeftSizer->Add(pLeftGridSizer);
  pLeftSizer->AddSpacer(20);
  pLeftSizer->Add(pUnitStaticBoxSizer);
  pLeftSizer->AddSpacer(20);
  pLeftSizer->Add(p2DTypeStaticBoxSizer);

	 wxBoxSizer   *pMainMiddleBoxSizer = new wxBoxSizer(wxHORIZONTAL);
	 pMainMiddleBoxSizer->Add(pLeftSizer, 0);
	 pMainMiddleBoxSizer->Add(pRightSizer, 0);

	 pTitlePage->SetSizer(pMainMiddleBoxSizer);
	 pTitlePage->Layout();
	 pMainMiddleBoxSizer->Fit(pTitlePage);

  pBNoteBook->AddPage(pTitlePage, "Title Page", true);
  pBNoteBook->Layout();

  Layout();

  pBDialog = new BDialog();
  pBDialog->CreateDialog(pTitlePage);


	return pTitlePage;
}



----------------------------------------------------------------------

Comment By: chris elliott (biol75)
Date: 2007-05-31 08:23

Message:
Logged In: YES 
user_id=84704
Originator: NO

I tried:

MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize&
size)
    : wxFrame((wxFrame *)NULL, -1, title, pos, size)
    {
        // create a child control here
        wxPanel * panel = new wxPanel (this, -1) ;
        wxArrayString strings;
        strings.Add("One");
        strings.Add("Two");
        wxRadioBox *radioBox = new wxRadioBox(panel, -1, "",
wxDefaultPosition, wxDefaultSize, strings, 2, wxRA_SPECIFY_ROWS);
    }

and all was ok with the compile and run. What exactly was the code the
caused the error, and was it a compile time or run-time error?

chris

----------------------------------------------------------------------

Comment By: microtek (microtek21)
Date: 2007-05-30 08:28

Message:
Logged In: YES 
user_id=1774531
Originator: YES

This happens in the 2.8.3 version.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1728397&group_id=9863




More information about the wx-dev mailing list