fix crash pgadmin3

Исправлена ошибка которая стала появлятся после новых изменений.
Ошибка вызвана особенностями работы диалоговых окон.
This commit is contained in:
lsv 2025-08-06 09:51:50 +05:00 committed by lsv
parent b539dc493b
commit 55080c0161
5 changed files with 43 additions and 15 deletions

View file

@ -37,6 +37,7 @@ ctlListView::ctlListView(wxWindow* p, int id, wxPoint pos, wxSize siz, long attr
nosort = false;
order = 1;
prev_col = -1;
storelongstring = false;
Connect(wxID_ANY, wxEVT_LIST_COL_CLICK, wxListEventHandler(ctlListView::OnSortGrid));
}
#include <map>
@ -124,8 +125,7 @@ long ctlListView::GetSelection()
return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}
wxString ctlListView::GetText(long row, long col)
wxString ctlListView::GetTextLong(long row, long col)
{
wxListItem item;
item.SetId(row);
@ -135,13 +135,24 @@ wxString ctlListView::GetText(long row, long col)
wxString v = item.GetText();
if (storelongstring) {
int len = v.Length();
if (len==200 && row >= 0 && col==0 && row < longstring.size()) {
if (len == 200 && row >= 0 && col == 0 && row < longstring.size()) {
return longstring[row];
}
}
return v;
};
wxString ctlListView::GetText(long row, long col)
{
wxListItem item;
item.SetId(row);
item.SetColumn(col);
item.SetMask(wxLIST_MASK_TEXT);
GetItem(item);
wxString v = item.GetText();
return v;
};
void ctlListView::AddColumn(const wxString& text, int size, int format)
{
@ -157,19 +168,34 @@ void ctlListView::AddColumn(const wxString& text, int size, int format)
long ctlListView::AppendItem(int icon, const wxString& val, const wxString& val2, const wxString& val3, const wxString& val4)
{
long idx = GetItemCount();
long pos;
pos = InsertItem(idx, val, icon);
if (!val2.IsEmpty())
SetItem(pos, 1, val2);
if (!val3.IsEmpty())
SetItem(pos, 2, val3);
if (!val4.IsEmpty())
SetItem(pos, 3, val4);
return pos;
}
long ctlListView::AppendItemLong(int icon, const wxString& val, const wxString& val2, const wxString& val3, const wxString& val4)
{
long idx = GetItemCount();
long pos;
if (storelongstring) {
if (val.Length() > 200) {
longstring.push_back(val);
pos = InsertItem(idx, val.Mid(0,200), icon);
pos = InsertItem(idx, val.Mid(0, 200), icon);
}
else {
longstring.push_back(wxEmptyString);
pos = InsertItem(idx, val, icon);
}
} else
}
else
pos = InsertItem(idx, val, icon);
if (!val2.IsEmpty())
SetItem(pos, 1, val2);

View file

@ -389,7 +389,7 @@ bool ctlNavigatePanel::RunKeyCommand(wxKeyEvent& event,int numCmd) {
if (isok && (cmdName == "FindState")) ncmd = 2;
if (isok && (ncmd>0)) {
long itemFocus = ctrl->GetFocusedItem();
wxString str = ctrl->GetText(itemFocus);
wxString str = ctrl->GetTextLong(itemFocus);
CSVTokenizer tk(str);
// Get the fields from the CSV log.
@ -700,7 +700,7 @@ void ctlNavigatePanel::OnMouse(wxMouseEvent& evt) {
wxString tt;
if (i >= 0 && i < items_mark.size() && items_mark[i] > pos) i--;
if (i >= 0 && i < items_mark.size() ) {
tt = ctrl->GetText(items_mark[i]);
tt = ctrl->GetTextLong(items_mark[i]);
this->SetToolTip(tt);
}
else
@ -990,7 +990,7 @@ int ctlNavigatePanel::FindText(wxString findtext, int position, bool directionUp
// this item is selected - do whatever is needed with it
//wxLogMessage("Item %ld is focused.", item);
//long fpos = logList->FindItem(item, logFindString, true);
wxString s = ctrl->GetText(item);
wxString s = ctrl->GetTextLong(item);
item++;
if (!(s.Find(logFindString) > -1)) {
continue;