Bug 1152921 - Always initialize platform-specific booleans in PrintData before sending over IPC. r=mconley
authorL. David Baron <dbaron@dbaron.org>
Thu, 16 Apr 2015 19:27:01 -0700
changeset 239693 da7ce9761d8e1b3889e0f850277534633cebc7bd
parent 239692 cfb6c36caf63ad90d248400c93538877155e69af
child 239694 a8cfb09ecc21dd10ccaa117b7f9ee216d2504b12
push id12444
push userryanvm@gmail.com
push dateFri, 17 Apr 2015 20:04:42 +0000
treeherderfx-team@560a202db924 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1152921
milestone40.0a1
Bug 1152921 - Always initialize platform-specific booleans in PrintData before sending over IPC. r=mconley This fixes the crash in Linux debug builds bringing up the print dialog, though there's still a crash when closing it.
widget/nsPrintOptionsImpl.cpp
--- a/widget/nsPrintOptionsImpl.cpp
+++ b/widget/nsPrintOptionsImpl.cpp
@@ -218,16 +218,28 @@ nsPrintOptions::SerializeToPrintData(nsI
   aSettings->GetOutputFormat(&data->outputFormat());
   aSettings->GetPrintPageDelay(&data->printPageDelay());
   aSettings->GetResolution(&data->resolution());
   aSettings->GetDuplex(&data->duplex());
   aSettings->GetIsInitializedFromPrinter(&data->isInitializedFromPrinter());
   aSettings->GetIsInitializedFromPrefs(&data->isInitializedFromPrefs());
   aSettings->GetPersistMarginBoxSettings(&data->persistMarginBoxSettings());
 
+  // Initialize the platform-specific values that don't
+  // default-initialize, so that we don't send uninitialized data over
+  // IPC (which leads to valgrind warnings, and, for bools, fatal
+  // assertions).
+  // data->driverName() default-initializes
+  // data->deviceName() default-initializes
+  data->isFramesetDocument() = false;
+  data->isFramesetFrameSelected() = false;
+  data->isIFrameSelected() = false;
+  data->isRangeSelection() = false;
+  // data->GTKPrintSettings() default-initializes
+
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintOptions::DeserializeToPrintSettings(const PrintData& data,
                                            nsIPrintSettings* settings)
 {
   settings->SetStartPageRange(data.startPageRange());