Description: The vgsplit dialog could crash or lvs not be deactivated
The vgsplit dialog will crash the program if it is called on an empty 
vg and OK is clicked. Sometimes active lvs are not properly deactivated
before splitting.
 .
 kvpm (0.9.9-1) unstable; urgency=low
 .
   [ Benjamin J. Scott ]
   * New upstream release (closes: #710287)
Author: Benjamin J. Scott <benscott@nwlink.com>
Bug-Debian: https://bugs.debian.org/710287

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- kvpm-0.9.9.orig/kvpm/vgsplit.cpp
+++ kvpm-0.9.9/kvpm/vgsplit.cpp
@@ -1,7 +1,7 @@
 /*
  *
  *
- * Copyright (C) 2010, 2011, 2012, 2013 Benjamin Scott   <benscott@nwlink.com>
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014 Benjamin Scott   <benscott@nwlink.com>
  *
  * This file is part of the kvpm project.
  *
@@ -71,9 +71,6 @@ VGSplitDialog::VGSplitDialog(VolGroup *v
     connect(m_new_vg_name, SIGNAL(textEdited(QString)),
             this, SLOT(validateOK()));
 
-    connect(this, SIGNAL(okClicked()),
-            this, SLOT(deactivate()));
-
     KTabWidget *const tw = new KTabWidget();
     layout->addWidget(tw);
 
@@ -122,6 +119,8 @@ void VGSplitDialog::validateOK()
 
 void VGSplitDialog::commit()
 {
+    deactivate();
+
     QStringList args = QStringList() << "vgsplit" << m_vg->getName() << m_new_vg_name->text(); 
 
     for (int x = m_right_pv_list->count() - 1; x >= 0; x--)
@@ -146,10 +145,11 @@ void VGSplitDialog::deactivate()
     if ((vg_dm = lvm_vg_open(lvm, vg_name.data(), "w", 0x0))) {
 
         for (int x = 0; x < moving_lvs.size(); x++) {
-            lv_dm_list = lvm_vg_list_lvs(vg_dm);
-            dm_list_iterate_items(lv_list, lv_dm_list) {
-                if (QString(lvm_lv_get_name(lv_list->lv)).trimmed() == moving_lvs[x])
-                    lvs_to_deactivate.append(lv_list->lv);
+            if ((lv_dm_list = lvm_vg_list_lvs(vg_dm))) {
+                dm_list_iterate_items(lv_list, lv_dm_list) {
+                    if (QString(lvm_lv_get_name(lv_list->lv)).trimmed() == moving_lvs[x])
+                        lvs_to_deactivate.append(lv_list->lv);
+                }
             }
         }
 
--- kvpm-0.9.9.orig/kvpm/vgsplit.h
+++ kvpm-0.9.9/kvpm/vgsplit.h
@@ -1,7 +1,7 @@
 /*
  *
  *
- * Copyright (C) 2010, 2011, 2012, 2013 Benjamin Scott   <benscott@nwlink.com>
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014 Benjamin Scott   <benscott@nwlink.com>
  *
  * This file is part of the Kvpm project.
  *
@@ -52,6 +52,7 @@ class VGSplitDialog : public KvpmDialog
     VolGroup *m_vg;
 
     LvList getFullLvList();
+    void deactivate();     // active lvs must be deactivated before moving
 
     QWidget *buildLvLists(const QStringList mobileLvNames, const QStringList fixedLvNames);
     QWidget *buildPvLists(const QStringList mobilePvNames, const QStringList fixedPvNames);
@@ -77,7 +78,6 @@ private slots:
     void addLvList();
     void addPvList();
     void commit();
-    void deactivate();     // active lvs must be deactivated before moving
     void enableLvArrows();
     void enablePvArrows();
     void removePvList();
