Last Comment Bug 705454 - Loading of module PMMERGE to compute screen size is wrong
: Loading of module PMMERGE to compute screen size is wrong
Status: RESOLVED FIXED
OS/2 only file
:
Product: Core Graveyard
Classification: Graveyard
Component: Widget: OS/2 (show other bugs)
: Trunk
: x86 OS/2
: -- normal (vote)
: mozilla11
Assigned To: Dave Yeo
:
Mentors:
Depends on:
Blocks: 67913
  Show dependency treegraph
 
Reported: 2011-11-26 09:10 PST by Erdmann
Modified: 2014-12-09 11:27 PST (History)
6 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch based on Lars comment (1.04 KB, patch)
2011-11-27 10:23 PST, Dave Yeo
no flags Details | Diff | Review
Patch based on Lars comment, with missed DosQueryModuleHandle() (1.04 KB, patch)
2011-11-27 13:11 PST, Dave Yeo
wuno: review+
Details | Diff | Review

Description Erdmann 2011-11-26 09:10:06 PST
User Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET4.0C; MALC)




Expected results:

http://dxr.mozilla.org/mozilla/mozilla-central/widget/src/os2/nsScreenOS2.cpp.html: 

routine "nsScreenOS2 :: GetAvailRect": this routine uses DosLoadModule, DosQueryProcAddress, DosFreeModule to get a function pointer to function to query screen size. However the module is freed before function pointer is actually used.
Since PMMERGE module is always loaded (if PM is loaded which is prerequisite for any graphical app) I suggest to replace with:

  if ( !rc && !pfnQueryDesktopWorkArea )
  {
      HMODULE hmod = 0;
      rc = DosQueryModuleHandle("PMMERGE", &hmod );
      if ( !rc )
      {
          rc = DosQueryProcAddr( hmod, 5469, NULL, (PFN*) &pfnQueryDesktopWorkArea ); // WinQueryDesktopWorkArea
      }
  }
if ( pfnQueryDesktopWorkArea && !rc )
...
Comment 1 Dave Yeo 2011-11-27 10:23:58 PST
Created attachment 577147 [details] [diff] [review]
Patch based on Lars comment

Lars, does this look correct?
I'll have to do a test build before asking for review.
Comment 2 Dave Yeo 2011-11-27 13:11:36 PST
Created attachment 577161 [details] [diff] [review]
Patch based on Lars comment, with missed DosQueryModuleHandle()
Comment 3 Erdmann 2011-11-27 16:27:40 PST
Yes, your suggested fix is OK.
Comment 4 Dave Yeo 2011-12-01 07:34:19 PST
Comment on attachment 577161 [details] [diff] [review]
Patch based on Lars comment, with missed DosQueryModuleHandle()

I've run this for a week with no adverse affects. SeaMonkey opens where it should without interfering with Warpcentre
Comment 6 Matt Brubeck (:mbrubeck) 2011-12-05 10:40:07 PST
https://hg.mozilla.org/mozilla-central/rev/dbe04a04bc41

Note You need to log in before you can comment on or make changes to this bug.