Thread overview
[Issue 3442] New: scope(exit) Problem
Oct 26, 2009
Vermi
Oct 30, 2009
Don
Dec 30, 2009
Don
October 26, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3442

           Summary: scope(exit) Problem
           Product: D
           Version: 2.035
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: moi@vermi.fr


--- Comment #0 from Vermi <moi@vermi.fr> 2009-10-26 04:00:32 PDT ---
I don't know if it's really a dmd bug or it's a windows bug, because I made several tests and I don't really understand where is the error. Here is the code : (Working with earlier version of dmd (2.022 if I remember well) :

protected bool _onPaint(PAINTSTRUCT paintStr)
{
  int oldMode = SetBkMode(paintStr.hdc, TRANSPARENT);
  scope(exit)
  {
    SetBkMode(paintStr.hdc, oldMode);
    MessageBoxA(null, "tic", "tic", MB_OK);
  }

  // Some code

  return true;
}


If the function return without exception, the code in the scope statement is properly executed and functionnal, the Background Mode for the DC is restored to OPAQUE (it's original value).

If an exception is thrown ( with the code : (cast(Object)null).toString() for
example ), The MessageBox show, but the background mode the DC is not restored,
and the background simply disapear in the window.

I made some tests on the return value of SetBkMode :

If an exception is thrown, SetBkMode return OPAQUE (wich is strange, it should return TRANSPARENT according to msdn).

If no exception is thrown, SetBkMode return 0, wich is strange too, because 0 means error. I don't know what to think.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 30, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3442


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-10-30 05:37:35 PDT ---
Please attach a complete test case. It sounds like bug 1894 to me (see also bug
1087).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 30, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3442


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-12-29 22:12:51 PST ---
I'm closing this as invalid since it has no test case. But it is probably a duplicate of one of the bugs I mentioned. Reopen if you have a complete test case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------