Author Topic: Strange wxSmith behaviour  (Read 1944 times)

Offline paul_c_weiss

  • Multiple posting newcomer
  • *
  • Posts: 10
Strange wxSmith behaviour
« on: April 16, 2016, 05:21:06 pm »
Hello!
I am working with Code::Blocks 16.01 and wxWidgets 3.0.
Of late, I am facing an issue which is for me difficult to understand.

I have a program with a pretty complexframe with right in its middle a panel which size is fixed to 540 x 540.
This program compiles, links, and runs without any error, warning, or problem.

For some reason, I have decided to change the panel size to 360 x 360 (there is no issue with its content...).
After performing this modification with the wxSmith RAD, the project rebuilds without any error or warning.
Alas, I now get an execution error!

Worse, if I back-correct the panel size to 540 x 540, and obviously rebuild the project, I STILL have an execution error

Bad luck!

Now, it happens that the initial and back-corrected sections of the code are NOT identical:


  ......
  AllMaskedButton = new wxButton(HidePanel, ID_BUTTON11, _("Tous"), wxPoint(25,50), wxSize(50,25), 0, wxDefaultValidator,   _T("ID_BUTTON11"));
    BoxSizer3->Add(AllMaskedButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
    HidePanel->SetSizer(BoxSizer3);

    SetSizer(BoxSizer3);           <- THESE 2 LINES ARE NOT PRESENT IN THE INITIAL FILE
    Layout();                             <- THESE 2 LINES ARE NOT PRESENT IN THE INITIAL FILE

    BoxSizer2->Add(HidePanel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
    BoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
    Slate = new wxPanel(Panel1, ID_PANEL2, wxDefaultPosition, wxSize(540,540), wxDOUBLE_BORDER|wxTAB_TRAVERSAL, _T("ID_PANEL2"));
    BoxSizer4->Add(Slate, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
   ........

Two strange new lines appear in the main file!

Commenting off these lines solves the issue! Miraculously, the program runs again!


There are no meaningful differences between the corresponding .wxs files.

Now to some questions:

- Is this behaviour understood?
- Is this due, maybe, to a faulty frame structure?
- Are they some warnings relative to it (in some documentation, I mean...)

Regards!


 


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11931
    • Travis build status
Re: Strange wxSmith behaviour
« Reply #1 on: April 16, 2016, 05:56:46 pm »
- Is this behaviour understood?
- Is this due, maybe, to a faulty frame structure?
- Are they some warnings relative to it (in some documentation, I mean...)
No idea, but we'll need minimal sample project or exact steps to reproduce in a default wx project.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline paul_c_weiss

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Strange wxSmith behaviour
« Reply #2 on: April 16, 2016, 06:38:12 pm »
Nice...
and obvious...

I have not done that because the project is complex enough, and I suspect
that the devils lies in the complexity, precisely.

Thus isolating the problem may be difficult. I shall try, nevertheles, but this will take some time.

Thanks anyhow!

Offline paul_c_weiss

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Strange wxSmith behaviour
« Reply #3 on: April 18, 2016, 04:28:54 pm »
Ok, then...
I have now notably simplified my project (it now mainly consists in a frame which does nothing..)
However, the execution error is always present.

I have zipped the several project files and attached them to this post. Is this acceptable?
If not please tell me what exactly you expect  :).

In file IsolatingErrorMain.cpp you will notice lines 95 and 96:

SetSizer(BoxSizer3);
Layout();

These are wxSmith-generated. They do not seem to make a lot of sense in their position.
Furthermore, commenting them off yields a working project...

Clearly, this is the cause of the error. But why? and how to avoid it?

Regards!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: Strange wxSmith behaviour
« Reply #4 on: April 18, 2016, 05:33:04 pm »
FYI: The attached file IsolatingError.zip is a Windows wxWidgets MultiLib Project with hard coded paths.
I am trying to fix the Hard Code paths; but, I do NOT know enough to answer the OP issue even after I fix the hard code paths.

Edit2: It is also an wxWidgets shared project that tries to link to static wxWidgets libs.

Tim S.
« Last Edit: April 18, 2016, 06:01:35 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: Strange wxSmith behaviour
« Reply #5 on: April 18, 2016, 05:40:56 pm »
After editing the project to use wxWidgets 3.0 Shared Monolib I did NOT see the problem.

Tested with WXWIN_COMPATIBILITY_2_8=1 and WXWIN_COMPATIBILITY_2_6=0.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: Strange wxSmith behaviour
« Reply #6 on: April 18, 2016, 05:51:23 pm »
OP is making a major wxWidgets/CB mistake.
In places he has shared wxWidgets and in others he has static wxWidgets.
Note: This would likely NOT cause the compile error he is seeing.

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: Strange wxSmith behaviour
« Reply #7 on: April 18, 2016, 06:03:56 pm »
I recommend the OP delete the PCH file/folder (wx_pch.h.gch) and rebuild the project and see if the error goes away.
If it does NOT post the full build log of the reduced CB project.

Edit: I forgot it is a runtime and NOT a build error; therefore the mix of static/shared might cause the issue.
I tested for a runtime error and I got one; now to see if the OP fix makes the problem go away.

Tim S.
« Last Edit: April 18, 2016, 06:17:17 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: Strange wxSmith behaviour
« Reply #8 on: April 18, 2016, 06:21:01 pm »
The run-time error went away after I commented out the two lines the OP suggested.

I will check over the project I created and upload it for an wxSmith person to try.
NOTE: The OP did NOT include the "wxsmith\IsolatingErrorframe.wxs" file that I would guess will be needed.

Tim S.


C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6609
    • My Best Post
Re: Strange wxSmith behaviour
« Reply #9 on: April 18, 2016, 06:30:03 pm »
Attached new zipped edited project containing an wxWidgets 2.8 cbp file.
Edit: The wxWidgets 2.8 does NOT have the same crash on running the project; so, likely problem is a change caused by wxWidgets 3.0.

Added use of CB Global var wx30; changed to monolib and DLL wxWidgets build.
Removed the compiler of the PCH to save time for the wxSmith/CB Dev that looks at the problem.

Edit: Remember it is a run-time error and NOT an compile/link error; I forgot that, sorry about that.

Tim S.


« Last Edit: April 18, 2016, 06:52:19 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline paul_c_weiss

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Strange wxSmith behaviour
« Reply #10 on: April 19, 2016, 10:04:19 am »
Thank you for bearing with me!!

Now, some answer to your interrogations:

1) Apparently, the Windows zipper had some hiccups. Anyway the relevant .wxs file is no attached
   (I suppose that its structure play a role....)
2) Indeed I am in the process of porting my system from Code::Blocks 13.12, wxwidgets 2.8 to Code::Blocks 16.01, wxWidgets 3.0.
    For this reason, I have this program on both systems, and BOTH show an execution error, but not exactly the same.
    On  2.8, the error occurs at program closing, while on 3.0, it occurs at program beginning.
3) Apparently, I committed a critical sin by mixing themonolotic and shared options. Now, I know that this is not the subject of this post,
   but if somebody could explain me how to avoid this, I would be grateful. I created the project witn Code::Blocks wizard, the relevant option being:
   - wxSmith
  - Frame Based
  - use wxWidgets DLL
  - Enable Unicode
  - Create & use precomplied headers (PCH)
   Consciously, I didn ot do anything else? So what???

Thank you again, and regards!

Paul

Offline Xaviou

  • Regular
  • ***
  • Posts: 299
    • X@v's wxStuff
Re: Strange wxSmith behaviour
« Reply #11 on: April 28, 2016, 08:44:24 am »
Hi to all.

I've tested the small test project, and found the error :
In the constructor of the frame, a sizer is affected to both a child panel and the frame itself (lines 94 and 95).

I don't know if the code comes from wxSmith or or if it was entered manually by the author, but commenting the lines 95 and 96 removes the crash.

Regards
Xav'
The french wxWidgets site : http://www.wxdev.fr
My wxWidgets's stuff : https://wxstuff.xaviou.fr/