File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -232,9 +232,18 @@ struct pdf_out {
232232 * object as a static variable. */
233233static pdf_out pout ;
234234
235+ /* Tectonic: during the XeTeX pass, if a PDF is loaded as an image,
236+ * the current_output can be accessed without init_pdf_out_struct having
237+ * been called. So we add a flag to ensure that it's always initialized. */
238+ static int tectonic_pout_initialized = 0 ;
239+ static void init_pdf_out_struct (pdf_out * p );
240+
235241static pdf_out *
236242current_output (void )
237243{
244+ if (!tectonic_pout_initialized )
245+ init_pdf_out_struct (& pout );
246+
238247 return & pout ;
239248}
240249
@@ -275,6 +284,7 @@ init_pdf_out_struct (pdf_out *p)
275284
276285 p -> free_list = NEW ((PDF_NUM_INDIRECT_MAX + 1 )/8 , char );
277286 memset (p -> free_list , 0 , (PDF_NUM_INDIRECT_MAX + 1 )/8 );
287+ tectonic_pout_initialized = 1 ;
278288}
279289
280290static void
@@ -4384,4 +4394,6 @@ pdf_obj_reset_global_state(void)
43844394 p -> output .file_position = 0 ;
43854395 p -> output .line_position = 0 ;
43864396 p -> output .compression_saved = 0 ;
4397+
4398+ tectonic_pout_initialized = 0 ;
43874399}
You can’t perform that action at this time.
0 commit comments