Buggy code:
public class PrintDialog extends Dialog { int scope = PrinterData . ALL_PAGES ; int startPage = 1 ; int endPage = 1 ; boolean printToFile = false ; int handle ; int index ; byte [ ] settingsData ; public PrintDialog ( Shell parent ) { } public PrintDialog ( Shell parent , int style ) { } protected void checkSubclass ( ) { } public int getScope ( ) { } public void setScope ( int scope ) { } public int getStartPage ( ) { } public void setStartPage ( int startPage ) { } public int getEndPage ( ) { } public void setEndPage ( int endPage ) { } public boolean getPrintToFile ( ) { } public void setPrintToFile ( boolean printToFile ) { } public PrinterData open ( ) { <START_BUG> if ( ( OS . GTK_VERSION ) < ( OS . VERSION ( 2 , 9 , 0 ) ) ) { <END_BUG> return Printer . getDefaultPrinterData ( ) ; } else { byte [ ] titleBytes = Converter . wcsToMbcs ( null , getText ( ) , true ) ; int topHandle = getParent ( ) . handle ; while ( ( topHandle != 0 ) && ( ! ( OS . GTK_IS_WINDOW ( topHandle ) ) ) ) { topHandle = OS . gtk_widget_get_parent ( topHandle ) ; } handle = OS . gtk_print_unix_dialog_new ( titleBytes , topHandle ) ; OS . gtk_print_unix_dialog_set_current_page ( handle , ( - 1 ) ) ; OS . gtk_print_unix_dialog_set_manual_capabilities ( handle , ( ( ( OS . GTK_PRINT_CAPABILITY_COLLATE ) | ( OS . GTK_PRINT_CAPABILITY_COPIES ) ) | ( OS . GTK_PRINT_CAPABILITY_PAGE_SET ) ) ) ; int settings = OS . gtk_print_settings_new ( ) ; int page_setup = OS . gtk_page_setup_new ( ) ; Printer . setScope ( settings , scope , startPage , endPage ) ; if ( printToFile ) { byte [ ] buffer = Converter . wcsToMbcs ( null , "Print<seq2seq4repair_space>to<seq2seq4repair_space>File" , true ) ; OS . gtk_print_settings_set_printer ( settings , buffer ) ; } OS . gtk_print_unix_dialog_set_settings ( handle , settings ) ; OS . gtk_print_unix_dialog_set_page_setup ( handle , page_setup ) ; OS . g_object_unref ( settings ) ; OS . g_object_unref ( page_setup ) ; PrinterData data = null ; Display display = ( ( getParent ( ) ) != null ) ? getParent ( ) . getDisplay ( ) : Display . getCurrent ( ) ; String key = "org.eclipse.swt.internal.gtk2.idleProc" ; LONG idleProc = ( ( LONG ) ( display . getData ( key ) ) ) ; int idleHandle = OS . g_idle_add ( idleProc . value , 0 ) ; if ( ( OS . gtk_dialog_run ( handle ) ) == ( OS . GTK_RESPONSE_OK ) ) { int printer = OS . gtk_print_unix_dialog_get_selected_printer ( handle ) ; if ( printer != 0 ) { settings = OS . gtk_print_unix_dialog_get_settings ( handle ) ; page_setup = OS . gtk_print_unix_dialog_get_page_setup ( handle ) ; data = Printer . printerDataFromGtkPrinter ( printer ) ; int print_pages = OS . gtk_print_settings_get_print_pages ( settings ) ; switch ( print_pages ) { case OS . GTK_PRINT_PAGES_ALL : scope = PrinterData . ALL_PAGES ; break ; case OS . GTK_PRINT_PAGES_RANGES : scope = PrinterData . PAGE_RANGE ; int [ ] num_ranges = new int [ 1 ] ; int page_ranges = OS . gtk_print_settings_get_page_ranges ( settings , num_ranges ) ; int [ ] pageRange = new int [ 2 ] ; int length = num_ranges [ 0 ] ; int min = Integer . MAX_VALUE ; int max = 0 ; for ( int i = 0 ; i < length ; i ++ ) { OS . memmove ( pageRange , ( page_ranges + ( ( i * ( pageRange . length ) ) * 4 ) ) , ( ( pageRange . length ) * 4 ) ) ; min = Math . min ( min , ( ( pageRange [ 0 ] ) + 1 ) ) ; max = Math . max ( max , ( ( pageRange [ 1 ] ) + 1 ) ) ; } OS . g_free ( page_ranges ) ; startPage = ( min == ( Integer . MAX_VALUE ) ) ? 1 : min ; endPage = ( max == 0 ) ? 1 : max ; break ; case OS . GTK_PRINT_PAGES_CURRENT : scope = PrinterData . SELECTION ; startPage = endPage = OS . gtk_print_unix_dialog_get_current_page ( handle ) ; break ; } printToFile = data . name . equals ( "Print<seq2seq4repair_space>to<seq2seq4repair_space>File" ) ; if ( printToFile ) { int address = OS . gtk_print_settings_get ( settings , GTK_PRINT_SETTINGS_OUTPUT_URI ) ; int length = OS . strlen ( address ) ; byte [ ] buffer = new byte [ length ] ; OS . memmove ( buffer , address , length ) ; data . fileName = new String ( Converter . mbcsToWcs ( null , buffer ) ) ; } data . scope = scope ; data . startPage = startPage ; data . endPage = endPage ; data . printToFile = printToFile ; data . copyCount = OS . gtk_print_settings_get_n_copies ( settings ) ; data . collate = OS . gtk_print_settings_get_collate ( settings ) ; Callback printSettingsCallback = new Callback ( this , "GtkPrintSettingsFunc" , 3 ) ; int GtkPrintSettingsFunc = printSettingsCallback . getAddress ( ) ; if ( GtkPrintSettingsFunc == 0 ) SWT . error ( ERROR_NO_MORE_CALLBACKS ) ; index = 0 ; settingsData = new byte [ 1024 ] ; OS . gtk_print_settings_foreach ( settings , GtkPrintSettingsFunc , 0 ) ; printSettingsCallback . dispose ( ) ; ( index ) ++ ; store ( "orientation" , OS . gtk_page_setup_get_orientation ( page_setup ) ) ; store ( "top_margin" , OS . gtk_page_setup_get_top_margin ( page_setup , GTK_UNIT_MM ) ) ; store ( "bottom_margin" , OS . gtk_page_setup_get_bottom_margin ( page_setup , GTK_UNIT_MM ) ) ; store ( "left_margin" , OS . gtk_page_setup_get_left_margin ( page_setup , GTK_UNIT_MM ) ) ;

Fix:
if ( ( OS . GTK_VERSION ) < ( OS . VERSION ( 2 , 10 , 0 ) ) ) {