Hello, there
I'm new to wxWidgets. I've start dealing with it to develop my first GUI-based program. I've started reading some tutorials, some docs, some manuals and some other reading-things and I got my little first demo program running under Ubuntu Linux.
But I'm not satisfied yet. I want it to run under Windows now. And here I get in trouble. When I compile it, everything works fine, with one exception: my only self-designed dialog does not work. Actually, when I try to open it, my application crashes.
I really don't know where is the problem, since it's running perfectly under Linux and I've developed it with the wxGlade tool (and some extra handy-written code).
So, since I don't even know where to start debuggin or correcting or testing, and so on... I came here!
I'll attach my code (that is really small) and ask for a expert help from you guys.
The MainFrame.cpp creates the main frame from the program, with a toolbar, a menubar and a statusbar. The menu have only two working events: New and Exit. In the OnNew (File->New Project) is the problem. It creates an NewProject dialog, that is all designed in NewProject.cpp. On Windows, it crashes here.
Since now, thank you all for the help.
Regards,
Dirley Rodrigues
-----
Edit
And oh, I almost forgot. I'm compilling it on Windows using MSVC++ Express 2008 with both Debug|Win32 and Unicode Debug|Win32 configurations taken from a sample. I'm also using wxWidgets-2.8.10.
Unknown Application Crash Under MS Windows Topic is solved
Unknown Application Crash Under MS Windows
- Attachments
-
- MainFrame.cpp
- (7.47 KiB) Downloaded 95 times
-
- NewProject.cpp
- (4.09 KiB) Downloaded 89 times
-
- wxWorld Domination!
- Posts: 1471
- Joined: Tue Nov 14, 2006 7:58 am
- Location: Saint-Petersburg, Russia
Hi,
it looks like you are using uninitialized pointers (te_title here) in the event handlers:
Whether you know, what event handler OnText is called inside the ctor? In this code
OnChangeFolder() will be called before te_title is created.
One of ways to work around:
it looks like you are using uninitialized pointers (te_title here) in the event handlers:
Code: Select all
void NewProject::OnChangeFolder(wxCommandEvent &event)
{
if (have_changed_title == false)
{
te_title->ChangeValue(te_folder->GetValue());
}
}
Code: Select all
...
// begin wxGlade: NewProject::NewProject
label_3 = new wxStaticText(this, wxID_ANY, _("Project folder:"));
te_folder = new wxTextCtrl(this, ID_INPUT_FOLDER, default_folder);
label_4 = new wxStaticText(this, wxID_ANY, _("Game title:"));
te_title = new wxTextCtrl(this, ID_INPUT_TITLE, default_title);
...
One of ways to work around:
Code: Select all
...
te_title = 0;
te_folder = 0;
...
te_folder = new wxTextCtrl(this, ID_INPUT_FOLDER, default_folder);
te_title = new wxTextCtrl(this, ID_INPUT_TITLE, default_title);
...
void NewProject::OnChangeFolder(wxCommandEvent &event)
{
if (have_changed_title == false)
{
if( te_title && te_folder )
te_title->ChangeValue(te_folder->GetValue());
}
}
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10