Also worth noting, the attached log is from a debug+opt build, so the backtrace of the `nsPrintSettingsWin::CopyFromNative` call is missing a couple of stack-levels (presumably due to code-inlining optimizations) The log shows: ``` ###!!! ASSERTION: *****dholbert In nsPrintSettingsWin::CopyFromNative 'Error', file c:/Users/dholbert/builds/mozilla-central/mozilla/widget/windows/nsPrintSettingsWin.cpp:317 #01: nsDeviceContextSpecWin::Init (c:\Users\dholbert\builds\mozilla-central\mozilla\widget\windows\nsDeviceContextSpecWin.cpp:230) #02: nsPrintJob::DoCommonPrint (c:\Users\dholbert\builds\mozilla-central\mozilla\layout\printing\nsPrintJob.cpp:770) #03: nsPrintJob::CommonPrint (c:\Users\dholbert\builds\mozilla-central\mozilla\layout\printing\nsPrintJob.cpp:483) #04: nsPrintJob::PrintPreview (c:\Users\dholbert\builds\mozilla-central\mozilla\layout\printing\nsPrintJob.cpp:864) ``` Inside of stack-level #01 there (nsDeviceContextSpecWin::Init), we actually descend into `nsDeviceContextSpecWin::GetDataFromPrinter`[1] which is and from there into `nsPrintSettingsWin::CopyFromNative`, which is where we trip my logging patch's `NS_ERROR` line. This is the function that stomps on the custom unwriteable margin member-data in the print settings object, via its call to `InitUnwriteableMargin`[3] as noted above. [1] https://searchfox.org/mozilla-central/rev/6bb59b783b193f06d6744c5ccaac69a992e9ee7b/widget/windows/nsDeviceContextSpecWin.cpp#396 [2] https://searchfox.org/mozilla-central/rev/6bb59b783b193f06d6744c5ccaac69a992e9ee7b/widget/windows/nsPrintSettingsWin.cpp#312 [3] https://searchfox.org/mozilla-central/rev/6bb59b783b193f06d6744c5ccaac69a992e9ee7b/widget/windows/nsPrintSettingsWin.cpp#367
Bug 1680838 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Also worth noting, the attached log is from a debug+opt build, so the backtrace of the `nsPrintSettingsWin::CopyFromNative` call is missing a couple of stack-levels (presumably due to code-inlining optimizations) The log shows: ``` ###!!! ASSERTION: *****dholbert In nsPrintSettingsWin::CopyFromNative 'Error', file c:/Users/dholbert/builds/mozilla-central/mozilla/widget/windows/nsPrintSettingsWin.cpp:317 #01: nsDeviceContextSpecWin::Init (c:\Users\dholbert\builds\mozilla-central\mozilla\widget\windows\nsDeviceContextSpecWin.cpp:230) #02: nsPrintJob::DoCommonPrint (c:\Users\dholbert\builds\mozilla-central\mozilla\layout\printing\nsPrintJob.cpp:770) #03: nsPrintJob::CommonPrint (c:\Users\dholbert\builds\mozilla-central\mozilla\layout\printing\nsPrintJob.cpp:483) #04: nsPrintJob::PrintPreview (c:\Users\dholbert\builds\mozilla-central\mozilla\layout\printing\nsPrintJob.cpp:864) ``` Inside of stack-level #01 there (nsDeviceContextSpecWin::Init), we actually descend into `nsDeviceContextSpecWin::GetDataFromPrinter`[1] (which is inlined and hence doesn't show up in the backtrace), and from there, into `nsPrintSettingsWin::CopyFromNative`, which is where we trip my logging patch's `NS_ERROR` line. This is the function that stomps on the custom unwriteable margin member-data in the print settings object, via its call to `InitUnwriteableMargin`[3] as noted above. [1] https://searchfox.org/mozilla-central/rev/6bb59b783b193f06d6744c5ccaac69a992e9ee7b/widget/windows/nsDeviceContextSpecWin.cpp#396 [2] https://searchfox.org/mozilla-central/rev/6bb59b783b193f06d6744c5ccaac69a992e9ee7b/widget/windows/nsPrintSettingsWin.cpp#312 [3] https://searchfox.org/mozilla-central/rev/6bb59b783b193f06d6744c5ccaac69a992e9ee7b/widget/windows/nsPrintSettingsWin.cpp#367