Package: anjuta
Version: 1.2.2-6

Anjuta crashes in attempt to open C++ source code file. My locale is RU_RU.KOI8-R. I set KOI8-R as default encoding for anjuta files. Radio button "Try to save in current locale's encoding" is selected. Attached file encoding is KOI8-R.

(anjuta:3036): GLib-GObject-WARNING **: IA__g_object_set_valist: construct property "type" for object `ESplash' can't be set after construction
** Message: Initializing AP class
** Message: Initializing AP Instance
** Message: Initializing launcher class
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting
QPixmap::operator=: Cannot assign to pixmap during painting


(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(anjuta:3036): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

** (anjuta:3036): CRITICAL **: file anjuta-encodings.c: line 327 (anjuta_encoding_get_charset): assertion `enc != NULL' failed

(anjuta:3036): GLib-CRITICAL **: g_convert: assertion `from_codeset != NULL' failed

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1224453184 (LWP 3036)]
0xb72ff39b in g_ucs4_to_utf16 () from /usr/lib/libglib-2.0.so.0
(gdb) where
#0 0xb72ff39b in g_ucs4_to_utf16 () from /usr/lib/libglib-2.0.so.0
#1 0xb72ff6ad in g_utf8_validate () from /usr/lib/libglib-2.0.so.0
#2 0x080eae16 in text_editor_set_line_marker ()
#3 0x080eaf7f in text_editor_set_line_marker ()
#4 0x080eb26b in text_editor_set_line_marker ()
#5 0x080eb6b0 in text_editor_load_file ()
#6 0x080e9558 in text_editor_new ()
#7 0x081007a6 in anjuta_append_text_editor ()
#8 0x08100fbe in anjuta_goto_file_line_mark ()
#9 0x08100f61 in anjuta_goto_file_line ()
#10 0x08096f5f in on_open_filesel_ok_clicked ()
#11 0x080b9a67 in fileselection_hide_widget ()
#12 0xb735b633 in g_cclosure_marshal_VOID () from /usr/lib/libgobject-2.0.so.0
#13 0xb73496b6 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#14 0xb735aec8 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#15 0xb7359f4c in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#16 0xb735a1e6 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#17 0xb766554c in gtk_dialog_response () from /usr/lib/libgtk-x11-2.0.so.0
#18 0xb7664d73 in gtk_dialog_new_with_buttons ()
from /usr/lib/libgtk-x11-2.0.so.0
#19 0xb735b3b6 in g_cclosure_marshal_VOID__VOID ()
from /usr/lib/libgobject-2.0.so.0
#20 0xb73496b6 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#21 0xb735aec8 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) quit
The program is running. Exit anyway? (y or n) y
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main() {
	char inputFilename[] = "KOLM2.SIS";
	short triangles[100-2][3][2];
	double areaOfTriangle[100-2];
	unsigned short foundedTriangles=0;
	ifstream inputFile(inputFilename);
	unsigned short N;
	inputFile >> N;
	if(!inputFile.fail() && N!=0) {
		short M[100-2][2];
		short numM[100-2][3];
		for(unsigned short i=0; i<N; i++) {
			inputFile >> M[i][0];
			inputFile >> M[i][1];
		}
		inputFile.close();
		
		short AB[2], BC[2], AC[2];
		double ABlen, BClen, AClen;
		bool areStraightLines=false;

		for(unsigned short i=0; i<N; i++){
			for(unsigned short j=0; j<N; j++) {
				if(j==i) continue;
				for(unsigned short k=0; k<N; k++) {
					if(k==j || k==i) continue;
					//AB=(x2-x1;y2-y1)
					//Создаём векторы из точек
					AB[0]=M[j][0]-M[i][0]; AB[1]=M[j][1]-M[i][1];
					BC[0]=M[j][0]-M[k][0]; BC[1]=M[k][1]-M[j][1];
					AC[0]=M[k][0]-M[i][0]; AC[1]=M[k][1]-M[i][1];
					
					//x1 * y2 != x2 * y1
					if((AB[0]*AC[1]-AC[0]*AB[1])==0) {
						cerr << "Найдена прямая линия трёх точек: " << i+1 << ", "<< j+1 << ", "<< k+1 << endl;
						areStraightLines=true;
					}else{
						//AB и AC
						//Найдём длины векторов
						ABlen=sqrt((double)AB[0]*AB[0]+AB[1]*AB[1]);
						AClen=sqrt((double)AC[0]*AC[0]+AC[1]*AC[1]);
						BClen=sqrt((double)BC[0]*BC[0]+BC[1]*BC[1]);
						if(AClen/BClen==1 || AClen/ABlen==1) {
							triangles[foundedTriangles][0][0]=M[i][0];
							triangles[foundedTriangles][0][1]=M[i][1];
							triangles[foundedTriangles][1][0]=M[j][0];
							triangles[foundedTriangles][1][1]=M[j][1];
							triangles[foundedTriangles][2][0]=M[k][0];
							triangles[foundedTriangles][2][1]=M[k][1];
							areaOfTriangle[foundedTriangles]=0.5*AClen*ABlen;
							numM[foundedTriangles][0]=i+1;
							numM[foundedTriangles][1]=j+1;
							numM[foundedTriangles][2]=k+1;
							foundedTriangles++;
						}
					}
				}
			}
		}

		if(areStraightLines) {
			cerr << "Исправте входные данные" << endl;
			return 1;
		}

		//Найдём треугольник с наименьшей площадью
		double minimalArea;
		if(foundedTriangles) {
			minimalArea=areaOfTriangle[0];
			for(unsigned short i=0; i<foundedTriangles-1; i++) {
				minimalArea=min(minimalArea, areaOfTriangle[i+1]);
			}
		}

		/**********************************************
		УРА!!!!!!! ДА ЗДРАВСТВУЕТ ПРОГРАММИСТ!
		**********************************************/
		for(unsigned short i=0; i<foundedTriangles; i++) {
				if(minimalArea==areaOfTriangle[i]) {
					cout << "Прямоугольный треугольник с минимальной площадью найден!" << endl
						<< "Точки, составляющие треугольник:" << endl
						<< triangles[i][0][0] << ", " << triangles[i][0][1] << endl
						<< triangles[i][1][0] << ", " << triangles[i][1][1] << endl
						<< triangles[i][2][0] << ", " << triangles[i][2][1] << endl;
					ofstream outputFile("KOLM.VAL");
					outputFile << numM[i][0] << " " << numM[i][1] << " " << numM[i][2] << endl;
					outputFile.close();
					break;
				}
		}
	}else{
		cerr << "Ошибка открытия входного файла " << inputFilename << endl;
	}
	
	return 0;
}

Reply via email to