[PATCH] ui/kis_dlg_adjustment_layer.{cc, h}: don't enable OK button if no filter is selected (avoid crash)

Melchior FRANZ mfranz at aon.at
Wed Feb 22 13:56:22 CET 2006


Don't enable the OK button in the constructor only because there's
a layer name given. At this point there's never a filter selected,
so we get a crash on clicking OK. Also don't enable the button if
the layer name was edited to be empty.

OK to commit?

m.


PS: I'll send another patch for automatically using the filter
    names once this crash here got fixed.



Index: kis_dlg_adjustment_layer.cc
===================================================================
--- kis_dlg_adjustment_layer.cc (revision 512396)
+++ kis_dlg_adjustment_layer.cc (working copy)
@@ -47,6 +47,7 @@
                                              const char *name)
     : KDialogBase(parent, name, true, "", Ok | Cancel)
     , m_image(img)
+    , m_currentFilter(0)
 {
     Q_ASSERT(img);

@@ -106,12 +107,12 @@

     m_currentConfigWidget = 0;

-    enableButtonOK( !m_layerName->text().isEmpty() );
+    enableButtonOK(0);
 }

 void KisDlgAdjustmentLayer::slotNameChanged( const QString & text )
 {
-    enableButtonOK( !text.isEmpty() );
+    enableButtonOK( m_currentFilter && !text.isEmpty() );
 }

 KisFilterConfiguration * KisDlgAdjustmentLayer::filterConfiguration() const
@@ -180,6 +181,8 @@
     } else {
         m_labelNoConfigWidget->show();
     }
+
+    enableButtonOK( !m_layerName->text().isEmpty() );
     refreshPreview();
 }



More information about the kimageshop mailing list