Author Topic: An unhandled exception ...  (Read 1090 times)

Offline LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
An unhandled exception ...
« on: July 01, 2020, 07:59:35 pm »
I wanted to edit some old translation files :
Quote
'All_codeblocks.po'  ( # 1.5MB)
'All_codeblocks.pot' ( # 1 MB)
with cb-12180, wx3.1.3, gcc-8.1.0, win32 (Vista Business)

When saving :
1- the cursor indicates a wait
2- memory usage increases linearly up to
3- Appearance of a window indicating an exception not maintained
4- after acknowledgement on any CB answer disappears
5- no RPT report

Active plugins:
Quote
- AutoSave
- Compiler
- Environment variables
- File extension handler

Quote
No problem with cb12180, wx3.0.3, gcc-7.5.0 OpenSuse-Leap-15.1

I'll test under Win7 tomorrow.

Can you check if you have the same problem ??

Attachments
- All_codeblocks.po
- cbBigFile.png
in
CBBigFile.7z
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12739
    • Travis build status
Re: An unhandled exception ...
« Reply #1 on: July 01, 2020, 08:20:21 pm »
What are the exact steps to reproduce the problem?
(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 stahta01

  • Lives here!
  • ****
  • Posts: 6957
    • My Best Post
Re: An unhandled exception ...
« Reply #2 on: July 01, 2020, 08:37:22 pm »
Did you answer Abort, Retry, or ignore to the message box?

Edit: I will try Abort; building C::B on Windows 7 64 bit with wxWidgets 3.0.x 64 bit.
Edit2: Saw no problem with C::B on Windows 7 64 bit with wxWidgets 3.0.x 64 bit
Now trying wxWidgets 3.1.x 64 bit; but, without the steps likely will fail to see error.
Edit4: Did not see problem with wxWidgets 3.1.3.

Edit3: Using MSys2 GCC self compiled 10.1.1 20200621

Tim S.
« Last Edit: July 02, 2020, 01:16:57 am 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: 6957
    • My Best Post
Re: An unhandled exception ...
« Reply #3 on: July 02, 2020, 02:26:53 am »
I just did a code search for the message and found one in "wxApp::OnExceptionInMainLoop" that is in file "src/msw/app.cpp".

Code: [Select]
bool wxApp::OnExceptionInMainLoop()
{
    // ask the user about what to do: use the Win32 API function here as it
    // could be dangerous to use any wxWidgets code in this state
    switch (
            ::MessageBox
              (
                NULL,
                wxT("An unhandled exception occurred. Press \"Abort\" to \
terminate the program,\r\n\
\"Retry\" to exit the program normally and \"Ignore\" to try to continue."),
                wxT("Unhandled exception"),
                MB_ABORTRETRYIGNORE |
                MB_ICONERROR|
                MB_TASKMODAL
              )
           )
    {
        case IDABORT:
            throw;

        default:
            wxFAIL_MSG( wxT("unexpected MessageBox() return code") );
            wxFALLTHROUGH;

        case IDRETRY:
            return false;

        case IDIGNORE:
            return true;
    }
}

Tim S.
« Last Edit: July 02, 2020, 02:34:22 am 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 LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #4 on: July 02, 2020, 07:35:23 pm »
@stahta01
Thank you for searching for the 'wx' function responsible for the message.
I can't find the call of this function...

@obfuscated
Steps to reproduce the problem with cb-12180,  gcc-8.1.0-dwarf, wx3.1.3,, win32 (Vista Business) :
1- active project: any
2- load 'All_codeblocks.po'
3- add spaces anywhere
4- save the file ... from that moment on,
- the cursor indicates a standby state for #40 S, then an exception message appears (see attached file)
Quote
1- action : 'Abortl' twice => new message 'Error unknown';  action : 'ok' once => CB closes
2- action : 'Retry' or Ignore' once  => CB closes and the modified file is not saved.

I've been running tests on Win7
Quote
1- win7-32: cb-12180, gcc-810-dwarf, wx-3.1.3
2- win7-64: cb-12180, gcc-810-seh, wx3.1.3
the save is correct
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12739
    • Travis build status
Re: An unhandled exception ...
« Reply #5 on: July 02, 2020, 09:10:30 pm »
I can't reproduce this on linux. You'll have to build a version with symbols and attach a debugger.
Do I understand correctly that the issue happens on vista, but it doesn't happen on win7?
(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 stahta01

  • Lives here!
  • ****
  • Posts: 6957
    • My Best Post
Re: An unhandled exception ...
« Reply #6 on: July 02, 2020, 10:32:03 pm »
Quote
1- active project: any

Does the problem happen if there is no open project?
Because all my tests were with no open projects.

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 LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #7 on: July 03, 2020, 10:40:46 am »
@stahta01
Quote
Win32, cb12180, gcc-810-dwarf, wx-313
I've just done the test without a project: the result is identical

@obfuscated
If I understand your instructions correctly, I have to run a version of 'cb-12180' in debug mode from another version of 'cb' to capture the backup of the file.

I did another test with a version
Quote
cb-12171, gcc-810-sljl, wx-313-sljl, Vista-32
and with 'WhatIsHang' from 'http://www.nirsoft.net'.
I managed to capture some information (bigfilepo.txt)
I also captured the state of Vista's memory  (processors.png)
- the linear increase of the memory corresponds to the saving of the file until the exception message is displayed.
- the memory drop corresponds to the destruction of 'CB'.


« Last Edit: July 03, 2020, 10:46:35 am by LETARTARE »
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #8 on: July 03, 2020, 11:42:27 am »
I just ran another test on Vista-32 :
I use 'cb-12171, gcc-810-sljl, wx-313-sljl',
wherein I load 'cb-12180, gcc-810-dwarf, wx-313-dwarf'.

I'm running 'cb-12180' in which
1- I load the file 'All_codeblocks.po'.
2- I modify this file
3- I save it
=> the backup is done properly !!
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #9 on: July 04, 2020, 10:52:59 am »
I think I've found the culprit !!
Code: [Select]
'cbEditor::Save()'call
Code: [Select]
'm_pData->EnsureConsistentLineEnds();' who call
Code: [Select]
'control->ConvertEOLs(control->GetEOLMode());' which is creating the problem!
A remark : 'control->GetEOLMode()' return 0 (CRLF) while the file contains only 'LF' !

If I comment on this call the problem disappears!
So it's in ...
Code: [Select]
void wxScintilla::ConvertEOLs(int eolMode)
{
    SendMsg(SCI_CONVERTEOLS, eolMode, 0);
}

Then I'm no longer competent.
« Last Edit: July 04, 2020, 11:15:48 am by LETARTARE »
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12739
    • Travis build status
Re: An unhandled exception ...
« Reply #10 on: July 04, 2020, 11:42:10 am »
Do the problem still happen if you disable optimizations? (set a global variable "cb_release_type=-g -O0")
(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 LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #11 on: July 04, 2020, 03:14:01 pm »
No, no improvement
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #12 on: July 04, 2020, 05:48:39 pm »
By finding out why 
Quote
A remark : 'control->GetEOLMode()' return 0 (CRLF) while the file contains only 'LF' !
I replaced
Code: [Select]
// control->ConvertEOLs(control->GetEOLMode());by
Code: [Select]
control->ConvertEOLs(2);in 'Scintilla.h' we find
Code: [Select]
#define SC_EOL_LF 2
and then BINGO : it works, no more problems !!

It is therefore a bad detection of the end of line by
Code: [Select]
int wxScintilla::GetEOLMode() const
{
    return SendMsg(SCI_GETEOLMODE, 0, 0);
}
with Win32.

Gentlemen developers, to your keyboards!

« Last Edit: July 04, 2020, 06:21:11 pm by LETARTARE »
CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6957
    • My Best Post
Re: An unhandled exception ...
« Reply #13 on: July 04, 2020, 06:29:54 pm »
By finding out why 
Quote
A remark : 'control->GetEOLMode()' return 0 (CRLF) while the file contains only 'LF' !
I replaced
Code: [Select]
// control->ConvertEOLs(control->GetEOLMode());by
Code: [Select]
control->ConvertEOLs(2);in 'Scintilla.h' we find
Code: [Select]
#define SC_EOL_LF 2
and then BINGO : it works, no more problems !!

It is therefore a bad detection of the end of line by
Code: [Select]
int wxScintilla::GetEOLMode() const
{
    return SendMsg(SCI_GETEOLMODE, 0, 0);
}
with Win32.

Gentlemen developers, to your keyboards!

Not till you post what settings you had inside Code::Blocks!
End of Line options are:
The real important two are
"Ensure Consistent EOLs" and "End of Line Mode".

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 LETARTARE

  • Regular
  • ***
  • Posts: 423
  • L'ami de l'homme.The friend of man.
Re: An unhandled exception ...
« Reply #14 on: July 04, 2020, 07:22:55 pm »
Yes, you are right.
I use with Win-32
Quote
Ensure Consistent EOLs = Yes
End of Line : CRLF

Well, the file I used contained only Linux end of line (LF) and with the previous options chosen: CB wants to modify the end of line of the file with the end of line of the option and crashes with Win32 !

CB-rev12189, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.3, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!